**********************************************************************
* Project ID
*
*
11/16/11 JJF
00 program written
/home/Reserve_Adjustments/
*
**********************************************************************
*
* Directory Entry Structure (dirent)
*
d p_dirent
d dirent
ds
*
based(p_dirent)
d_reserv1
16A
d_reserv2
10U 0
d_fileno
10U 0
d_reclen
10U 0
d_reserv3
10I 0
d_reserv4
8A
d_nlsinfo
12A
nls_ccsid
nls_cntry
2A
OVERLAY(d_nlsinfo:5)
nls_lang
3A
OVERLAY(d_nlsinfo:7)
nls_reserv
3A
OVERLAY(d_nlsinfo:10)
d_namelen
d_name
10I 0 OVERLAY(d_nlsinfo:1)
10U 0
640A
*-----------------------------------------------------------d opendir
pr
d dirname
EXTPROC('opendir')
VALUE
pr
d dirname
EXTPROC('readdir')
VALUE
pr
d dirname
EXTPROC('closedir')
VALUE
pr
10i 0
ExtProc('open')
filename
value
openflags
10i 0
value
mode
10u 0
value options(*nopass)
codepage
10u 0
value options(*nopass)
filehandle
datareceived
nbytes
pr
10i 0
ExtProc('read')
10i 0
value
value
10u 0
value
*-----------------------------------------------------------d close
d
pr
filehandle
10i 0
ExtProc('close')
10i 0
value
pr
256a
d FileName
256a
const
pr
d seconds
10u 0 Value
command
length
pr
extpgm('QCMDEXC')
256
15 5
pr
opdesc
Lilian
10i 0
picture
65535A
const options(*varsize)
OutputDate
65535A
const options(*varsize)
Feedback
12a
options(*omit)
d BaseDate
inz(D'1582-10-14')
d cmdlength
15 5
d cmdstring
d count
d cr
d data
65535A
d Data_Rec
65535A
d datasize
5 0
d dh
d Eol
d Error_Flag
d File
256
d FileName
256
varying
d FolderNames
256
dim(50)
d Fp
10i 0
d KeepLooping
d lf
d MyNewName
d N
5 0
d nDays
10i 0
256
3 0
Const(x'0D')
Const(x'0D25')
1A
INZ('0')
inz('1')
Const(x'25')
265
varying
10i 0
inz(1)
d O_TEXTDATA
10i 0
inz(16777216)
d Oflag
10i 0
d Omode
10u 0
d PathName
26
d Q
d R
5 0
d Rc
10i 0
inz('''')
d ReturnData
12
d SleepSeconds
10i 0 inz(1)
d ta
3 0
d Today
inz(*SYS)
ds
d bighunkdata
d
qualified inz
65535
OneSlice
60
dim(1000) overlay(bighunkdata:*next)
/free
exsr $GetFileName;
if ta > *zeros;
// read the tables one at a time
for count = 1 to ta;
filename = foldernames(count);
Error_flag = rdifsfil(Filename);
//exsr $MoveToHistory;
endfor;
endif;
enddo;
*inlr = *on;
clear filename;
// tables will hold all the names of the tables
clear TA;
clear folderNames;
endsr;
history
//-------------------------------------------
begsr $MoveToHistory;
MyNewName = %trim(ReturnData) +
%char(%subdt(Today:*days)) + '_' +
%char(%subdt(Today:*years)) + '_' +
%ScanRpl('.' : '' :
%char(%time())) + '.csv';
cmdlength = %len(%trim(cmdstring));
monitor;
$command(cmdstring:cmdlength);
on-error;
// process for errors
endmon;
cmdlength = %len(%trim(cmdstring));
monitor;
$command(cmdstring:cmdlength);
on-error;
// process for errors
endmon;
endsr;
//-------------------------------------------
/end-free
*------------------------------------------------------------*
*------------------------------------------------------------p RdIfsFil
d RdIfsFil
PI
Export
d FileName
256A
256A
d CharsRead
d CurChar
d Eof
Const
10i 0
1
const(x'00')
/free
Oflag = O_Rdonly + O_Textdata;
// need whole path here
File = %trim(FileName) + x'00';
Fp = open(%addr(File): Oflag);
if Fp < 0;
Error_Flag = *On;
Return Error_Flag;
Endif;
R = 0;
N = 0;
dou CurChar = Eof;
exsr getChar;
R+=1;
%Subst(Data: R: 1) = CurChar;
if CurChar = X'25';
%Subst(Data: R: 1) = *blanks;
endif;
select;
when R = 256 or CurChar = X'25';
if CurChar = X'25';
%Subst(Data: R: 1) = *blanks;
endif;
endsl;
enddo;
Return
Error_Flag;
if N = CharsRead;
CharsRead = Read(Fp:%Addr(Data_Rec): 2560);
N = *Zero;
endif;
endsr;
//--------------------------------------------------------/end-free
p RdIfsFil
*
*
11/16/11 JJF
00 program written
/home/Reserve_Adjustments/
*
**********************************************************************
*
* Directory Entry Structure (dirent)
*
d p_dirent
d dirent
ds
*
based(p_dirent)
d_reserv1
16A
d_reserv2
10U 0
d_fileno
10U 0
d_reclen
10U 0
d_reserv3
10I 0
d_reserv4
8A
d_nlsinfo
12A
nls_ccsid
nls_cntry
10I 0 OVERLAY(d_nlsinfo:1)
2A
OVERLAY(d_nlsinfo:5)
nls_lang
3A
OVERLAY(d_nlsinfo:7)
nls_reserv
3A
OVERLAY(d_nlsinfo:10)
d_namelen
d_name
10U 0
640A
pr
d dirname
EXTPROC('opendir')
VALUE
pr
d dirname
EXTPROC('readdir')
VALUE
pr
d dirname
EXTPROC('closedir')
VALUE
pr
10i 0
ExtProc('open')
filename
value
openflags
10i 0
value
mode
10u 0
value options(*nopass)
codepage
10u 0
value options(*nopass)
*-----------------------------------------------------------d read
d
filehandle
datareceived
nbytes
pr
10i 0
ExtProc('read')
10i 0
value
value
10u 0
value
pr
filehandle
10i 0
ExtProc('close')
10i 0
value
pr
d FileName
256a
256a
const
pr
d seconds
command
length
pr
extpgm('QCMDEXC')
256
15 5
pr
opdesc
Lilian
10i 0
picture
65535A
const options(*varsize)
OutputDate
65535A
const options(*varsize)
Feedback
12a
options(*omit)
d BaseDate
inz(D'1582-10-14')
d cmdlength
15 5
d cmdstring
d count
d cr
d data
65535A
d Data_Rec
65535A
d datasize
5 0
d dh
d Eol
d Error_Flag
d File
256
d FileName
256
varying
d FolderNames
256
dim(50)
d Fp
10i 0
d KeepLooping
d lf
d MyNewName
d N
5 0
d nDays
10i 0
256
3 0
Const(x'0D')
Const(x'0D25')
1A
INZ('0')
inz('1')
Const(x'25')
265
varying
10i 0
inz(1)
d O_TEXTDATA
10i 0
inz(16777216)
d Oflag
10i 0
d Omode
10u 0
d PathName
26
d Q
d R
5 0
d Rc
10i 0
d ReturnData
12
d SleepSeconds
10i 0 inz(1)
d ta
3 0
d Today
inz('''')
inz(*SYS)
ds
d bighunkdata
d
qualified inz
65535
OneSlice
60
dim(1000) overlay(bighunkdata:*next)
/free
exsr $GetFileName;
if ta > *zeros;
// read the tables one at a time
for count = 1 to ta;
filename = foldernames(count);
Error_flag = rdifsfil(Filename);
//exsr $MoveToHistory;
endfor;
endif;
enddo;
*inlr = *on;
clear filename;
// tables will hold all the names of the tables
clear TA;
clear folderNames;
endsr;
history
//-------------------------------------------
begsr $MoveToHistory;
MyNewName = %trim(ReturnData) +
%char(%subdt(Today:*days)) + '_' +
%char(%subdt(Today:*years)) + '_' +
%ScanRpl('.' : '' :
%char(%time())) + '.csv';
cmdlength = %len(%trim(cmdstring));
monitor;
$command(cmdstring:cmdlength);
on-error;
// process for errors
endmon;
endsr;
//-------------------------------------------
/end-free
*------------------------------------------------------------*
*------------------------------------------------------------p RdIfsFil
d RdIfsFil
PI
d FileName
Export
256A
256A
d CharsRead
d CurChar
d Eof
Const
10i 0
1
const(x'00')
/free
Oflag = O_Rdonly + O_Textdata;
// need whole path here
File = %trim(FileName) + x'00';
Fp = open(%addr(File): Oflag);
if Fp < 0;
Error_Flag = *On;
Return Error_Flag;
Endif;
R = 0;
N = 0;
dou CurChar = Eof;
exsr getChar;
R+=1;
%Subst(Data: R: 1) = CurChar;
if CurChar = X'25';
%Subst(Data: R: 1) = *blanks;
endif;
select;
when R = 256 or CurChar = X'25';
if CurChar = X'25';
%Subst(Data: R: 1) = *blanks;
endif;
endsl;
enddo;
Return
Error_Flag;
if N = CharsRead;
CharsRead = Read(Fp:%Addr(Data_Rec): 2560);
N = *Zero;
endif;
endsr;
//--------------------------------------------------------/end-free
p RdIfsFil