View previous topic :: View next topic
Author
Message
mk_kumar315 New User Joined: 21 Nov 2005Posts: 10
Hi,
I need to sort a file which contains the records as set of lines.
I/P:
0010BBBBB AAA Navigation-Incl trolley
luggage, bags
Tyres,support
0010BBBBB ZZZZZZyard Navigation-Incl lights
new one, support
radio, airconditioning
0010BBBBB MMMMMMMMMMyard Navigation-Incl lights
old one, support
airconditioning
0010BBBBB BBBBBBByard Navigation-Incl lights
common one, support
tape, airconditioning
0010BBBBB AAAAAAAAAAyard Navigation-Incl lights
0010BBBBB KKKKKKyard Navigation-Incl lights
Expected O/P :
0010BBBBB AAA Navigation-Incl trolley
luggage, bags
tyres,support
0010BBBBB AAAAAAAAAAyard Navigation-Incl lights
0010BBBBB BBBBBBByard Navigation-Incl lights
common one, support
tape, airconditioning
0010BBBBB KKKKKKyard Navigation-Incl lights
0010BBBBB MMMMMMMMMMyard Navigation-Incl lights
old one, support
airconditioning
0010BBBBB ZZZZZZyard Navigation-Incl lights
new one, support
radio, airconditioning
Here we need to sort the 2nd column and we need to write the output file with that set of records....
first record :
0010BBBBB AAA Navigation-Incl trolley
luggage, bags
tyres,support
and then the second record:
0010BBBBB AAAAAAAAAAyard Navigation-Incl lights
if i use simple sort then the output for the set of records is not possible.
M.K.Kumar
Back to top
Arun Raj Moderator Joined: 17 Oct 2006Posts: 2481 Location: @my desk
mk_kumar315,
Are you looking for a COBOL Solution?
Back to top
mk_kumar315 New User Joined: 21 Nov 2005Posts: 10
Yes,i believe it is possible with COBOL only
Please let me know is there any other method by using JCL.
Here I need to sort the 2 column of i/p file after the KEY and based on that i need write the set of lines of records to the output.The set of lines are considered as 1 record and its length may be 3 or 4 continuous lines.
Thanks in Advance,
MK.Kumar.
Back to top
Arun Raj Moderator Joined: 17 Oct 2006Posts: 2481 Location: @my desk
mk_kumar315,
Are all the "groups" having '0010' in pos 1-4 or do you expect other values also?
Back to top
Arun Raj Moderator Joined: 17 Oct 2006Posts: 2481 Location: @my desk
Quote:
Please let me know is there any other method by using JCL.
mk_kumar315,
If you have Syncsort, you can try out the below job. This assumes an input file of LRECL 80. You can modify it as per your file attributes.
Code:
//STEP1 EXEC PGM=SYNCTOOL
//IN DD DSN= input-file ---- FB,LRECL=80
//DFSMSG DD SYSOUT=*
//TOOLMSG DD SYSOUT=*
//T1 DD DSN=&&T1,DISP=(,PASS)
//OUT DD SYSOUT=*
//TOOLIN DD *
SPLICE FROM(IN) TO(T1) ON(89,8,CH) WITH(1,88) WITHALL -
KEEPBASE KEEPNODUPS USING(CTL1)
SORT FROM(T1) TO(OUT) USING(CTL2)
//CTL1CNTL DD *
INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,8,ZD)),
IFTHEN=(WHEN=(1,4,CH,EQ,C'0010'),
OVERLAY=(89:SEQNUM,8,ZD,97:11,70)),
IFTHEN=(WHEN=NONE,
OVERLAY=(89:SEQNUM,8,ZD,89:89,8,ZD,SUB,81,8,ZD,M11,LENGTH=8))
OUTFIL FNAMES=T1
//CTL2CNTL DD *
SORT FIELDS=(97,70,CH,A,81,8,CH,A)
OUTFIL FNAMES=OUT,BUILD=(1,80)
Back to top
Please enable JavaScript!