View previous topic :: View next topic
Author
Message
aneeta New User Joined: 08 Dec 2005Posts: 48 Location: Chennai
Hi all,
I have an input file FB of LRECL 80 with only 1 column.Each record in the input file is of different length..
Eg:
Code:
00456789
56890
003788906
3452678
1.I need the O/P file with a length of 21 characters with zeros padded in front of the field..
Eg:
Code:
000000000000000456789
000000000000000056890
000000000000003788906
000000000000003452678
2.Also I need to add ' ' and a comma at the end of the column
Eg:
Code:
'000000000000000456789',
'000000000000000056890',
'000000000000003788906',
'000000000000003452678',
Thanks
Aneeta
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
Aneeta,
Here's a DFSORT job that will do what you asked for:
Code:
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
00456789
56890
003788906
3452678
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC BUILD=(C'''',1,21,UFF,M11,LENGTH=21,C''',',80:X)
/*
Back to top
aneeta New User Joined: 08 Dec 2005Posts: 48 Location: Chennai
It worked..Thanks a lot Frank..
Back to top
aneeta New User Joined: 08 Dec 2005Posts: 48 Location: Chennai
Hi Frank,
I have 1 more additional requirement now..I need to add ( in the first record and ) in the last record along with ;(semicolon).
Eg:
('000000000000000456789',
'000000000000000056890',
'000000000000003788906',
'000000000000003452678');
Note:The last record will not contain ,(comma).
Pls help me..Pls let me know if I had to open a new POST for this and I would do.
Thanks
Aneeta
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
Aneeta,
That's a bit trickier, but here's a DFSORT job that will do what you asked for:
Code:
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
00456789
56890
003788906
3452678
/*
//SYM DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//SYSIN DD *
OPTION COPY
INREC OVERLAY=(81:SEQNUM,8,ZD)
* Add seqnums to input file.
OUTFIL FNAMES=T1
* Create symbol for last record as:
* LASTRCD,+nnnnnnnn
OUTFIL FNAMES=SYM,REMOVECC,NODETAIL,
BUILD=(1,80),
TRAILER1=('LASTRCD,+',81,8)
/*
//S2 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SORTIN DD DSN=&&T1,DISP=(OLD,PASS)
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC IFOUTLEN=80,
* Reformat each record to:
* 'ddddddddddddddddddddd',
IFTHEN=(WHEN=INIT,
BUILD=(C'''',1,21,UFF,M11,LENGTH=21,C''',',81:81,8)),
* Use seqnum = +1 to identify first record and
* reformat it to:
* ('ddddddddddddddddddddd',
IFTHEN=(WHEN=(81,8,ZD,EQ,+1),
BUILD=(C'(',1,24)),
* Use seqnum = LASTRCD to identify last record and
* reformat it to:
* 'ddddddddddddddddddddd');
IFTHEN=(WHEN=(81,8,ZD,EQ,LASTRCD),
OVERLAY=(24:C');'))
/*
Back to top
aneeta New User Joined: 08 Dec 2005Posts: 48 Location: Chennai
Hi Frank,
Thanks for the help.The JCL is working perfectly fine.But I am facing an issue when the input is only one record.
Eg:('000000000003452678'...the closing paranthese and semicolon is missing..
Pls help me..
Thanks
Aneeta
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
Aneeta,
Just change the control statements for the S2 step to:
Code:
OPTION COPY
INREC IFOUTLEN=80,
* Reformat each record to:
* 'ddddddddddddddddddddd',
IFTHEN=(WHEN=INIT,
BUILD=(C'''',1,21,UFF,M11,LENGTH=21,C''',',81:81,8)),
* Use seqnum = +1 and seqnum = LASTRCD to handle only
* one record and reformat it to:
* ('ddddddddddddddddddddd');
IFTHEN=(WHEN=(81,8,ZD,EQ,+1,AND,81,8,ZD,EQ,LASTRCD),
BUILD=(C'(',1,23,C');')),
* Use seqnum = +1 to identify first record and
* reformat it to:
* ('ddddddddddddddddddddd',
IFTHEN=(WHEN=(81,8,ZD,EQ,+1),
BUILD=(C'(',1,24)),
* Use seqnum = LASTRCD to identify last record and
* reformat it to:
* 'ddddddddddddddddddddd');
IFTHEN=(WHEN=(81,8,ZD,EQ,LASTRCD),
OVERLAY=(24:C');'))
Back to top
aneeta New User Joined: 08 Dec 2005Posts: 48 Location: Chennai
Thanks Frank
Back to top
Please enable JavaScript!