Here's my requirement:
1. I have a file which has just the date in the format (ccyymmdd)
2. I want to create another file using this which has only the year and the month in the format YYYYMON.
Rather than searching for a tool you can write one.....
You can use Rexx....
The sample code for this will be like....
/*rexx*/
"Alloc da('Input dataset') f(ipfile) shr reuse"
"execio * ipfile(stem input. finis"
/*All the data in the file will be now in input. array*/
"free f(ipfile)"
do i=1 to input.0
a=words(input.i)
do j=1 to a
if length(strip(word(input.i,a))) = 8 then do
if substr(word(input.i,a),1,4) = 2003 then do
fdate = strip(substr(word(input.i,a),1,8))
if datatype(fdate) = 'NUM' & substr(fdate,5,2) <13 & substr(fdate,7,2) <31 then do
/* check & add change for month here*/
end
end
end
end
end
made some mistakes & forgot the imp stuff....
it should be fine now.....
it would be more easier & helpful if u coul give the record length of the file & char position of the date
/*rexx*/
"Alloc da('Input dataset') f(ipfile) shr reuse"
"execio * ipfile(stem input. finis"
/*All the data in the file will be now in input. array*/
"free f(ipfile)"
do i=1 to input.0
a=words(input.i)
output.i=''
do j=1 to a
tmp=word(input.i,j)
if length(strip(word(input.i,j))) = 8 then do
if substr(word(input.i,j),1,4) = 2003 then do
fdate = strip(word(input.i,j))
if datatype(fdate) = 'NUM' & substr(fdate,5,2) <13 & substr(fdate,7,2) <31 then do
/* check & add change for month here*/
/* while u check for month & change it*/
if substr(fdate,5,2) = 01 then do
fdate=substr(fdate,1,4) || 'JAN'
tmp=fdate
/* for all months u can use a select expression here*/
end
end
end
output.i=ouput.i || tmp
end
end
Hi,
Thanks for your prompt reply.
Considering Mainframe I/O system, REXX program will utilise more resources than a utility program or COBOL program. Since I have more than 10k records to process,I cannot implement REXX program as a solution.
Pls let me know if thr is any utility that I can use. Any idea abt ICETOOL utility ?
Once again thanks a lot for your help.
You can use DFSORT or SYNCSORT..... Y ICETOOL when the solution is easier with these.....
Lets assume your 20030819 file is of record length 100 & this 20030819 is in position 51.
2 -51, 0 -52 et all.... so 08 will be in pos 55,56
Sort fields = copy
outrec =(1:1,54,
55:55,2,
change=(3,
C'01',C'JAN',
C'02',C'FEB', continue for all months
C'12',C'DEC'),
nomatch=(C'BAD'), optional....
58:59,100) ==> u r skipping the date here by giving 59,100