View previous topic :: View next topic
Author
Message
sub7 New User Joined: 12 Sep 2005Posts: 9
Hello,
Can somebody help on how to achieve the following using DFSORT or Syncsort
Input fixed length file:
Code:
Col1 Col2 Col3 Col4 Col5 Col6
========================================
1234|111111111|000000002|0002|VAC|BEFGHIJ|
2345|333333333|000000001|0002|BUR|DEFGHIJ|
1234|222222222|000000003|0003|BUR|CDFGHIJ|
1234|111111111|000000001|0002|BAC|DEFGHIJ|
1234|111111111|000000003|0002|SPC|DEFGHIJ|
1234|222222222|000000003|0003|MST|DEFGHIJ|
1234|222222222|000000003|0003|KEF|EFFGHIJ|
2345|333333333|000000001|0002|KEF|DEFGHIJ|
Output:
Col1 Col2 Col3 Col4 Col5 Col6
========================================
1234|111111111|000000015|0002|BAC|DEFGHIJ|
1234|111111111|000000015|0002|VAC|BEFGHIJ|
1234|111111111|000000015|0002|SPC|DEFGHIJ|
1234|222222222|000000015|0003|MST|DEFGHIJ|
1234|222222222|000000015|0003|BUR|CDFGHIJ|
1234|222222222|000000015|0003|KEF|EFFGHIJ|
2345|333333333|000000002|0002|BUR|DEFGHIJ|
2345|333333333|000000002|0002|KEF|DEFGHIJ|
OUTPUT condition:
A.Output need to be in sorted order on Col1,Col2
B.Col3 - Must be sum of amount in Col3 and to overlay;for matching Col1
C.Must have all records as input file as is.
Any help is appreciated!!
-Neo
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
What is the RECFM and LRECL of your input file?
What is the starting position, length and format of each field?
Please run this DFSORT job and show the //SYSOUT messages so I can tell what level you're at:
Code:
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
RECORD
//SORTOUT DD DUMMY
//SYSIN DD *
OPTION COPY
/*
Back to top
sub7 New User Joined: 12 Sep 2005Posts: 9
Hi Frank,
LRECL=200 Bytes (I have excluded the rest of data from record)
COl1 - Starting pos 1 and 5 Bytes long PIC X(5)
COl2 - Starting pos 6 and 9 Bytes long PIC X(9)
Col3 - Starting pos 16 and 13 Bytes long PIC 9(10)V9(3) implied decimal.
(in the above please treat the amount as 0000000000015).
Col1,2,Col4,5,6 -just need to be included as is.
and the JOb status below:
Job successfully processed and here is the SYSOUT
WER211B SYNCSMF CALLED BY SYNCSORT; RC=0000
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE
WER416B BSAM WAS USED FOR SORTIN
WER416B BSAM WAS USED FOR SORTOUT
WER054I RCD IN 1, OUT 1
WER169I RELEASE 1.3 BATCH 0494 TPF LEVEL 2.0
WER052I END SYNCSORT - FPRTSORT,STEP001,,DIAG=C600,4082,EAA2
-Neo
Back to top
enrico-sorichetti Superior Member Joined: 14 Mar 2007Posts: 10873 Location: italy
the messages show that You are using SYNCSORT,
topic moved to the proper forum
did You read the forum rules about duplicate posts on the IBMMAINFRAME domain
looks like not !
please clarify where You want to be answered
( somebody will delete the duplicate/useless post)
Back to top
sub7 New User Joined: 12 Sep 2005Posts: 9
My bad.
Thanks Enrico ,for moving to appropritae place.
Can sombody suggest a solution using Sort for my problem?
-Neo.
Back to top
venkatesh83be New User Joined: 10 Aug 2009Posts: 12 Location: Chennai
Try this code
Code:
//SORT01 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//SORTIN DD *
1234|111111111|000000002|0002|VAC|BEFGHIJ|
2345|333333333|000000001|0002|BUR|DEFGHIJ|
1234|222222222|000000003|0003|BUR|CDFGHIJ|
1234|111111111|000000001|0002|BAC|DEFGHIJ|
1234|111111111|000000003|0002|SPC|DEFGHIJ|
1234|222222222|000000003|0003|MST|DEFGHIJ|
1234|222222222|000000003|0003|KEF|EFFGHIJ|
2345|333333333|000000001|0002|KEF|DEFGHIJ|
/*
//SORTOUT DD DSN=&&TEMP,
// DISP=(,PASS)
//SYSIN DD *
SORT FIELDS=(1,4,CH,A)
SUM FIELDS=(16,9,ZD)
OUTREC FIELDS=(1,4,16,9)
/*
//SORT2 EXEC PGM=SORT
//SORTJNF1 DD *
1234|111111111|000000002|0002|VAC|BEFGHIJ|
2345|333333333|000000001|0002|BUR|DEFGHIJ|
1234|222222222|000000003|0003|BUR|CDFGHIJ|
1234|111111111|000000001|0002|BAC|DEFGHIJ|
1234|111111111|000000003|0002|SPC|DEFGHIJ|
1234|222222222|000000003|0003|MST|DEFGHIJ|
1234|222222222|000000003|0003|KEF|EFFGHIJ|
2345|333333333|000000001|0002|KEF|DEFGHIJ|
/*
//SORTJNF2 DD DISP=SHR,DSN=&&TEMP
//SORTOUT DD DSN=ZI15.TEST.FORUM.JOIN,DISP=(NEW,CATLG),
// UNIT=SYSDA,SPACE=(TRK,(1,1),RLSE)
//SYSOUT DD SYSOUT=*
//SYSIN DD *
JOINKEYS FILES=F1,FIELDS=(1,4,A)
JOINKEYS FILES=F2,FIELDS=(1,4,A)
REFORMAT FIELDS=(F1:1,42,F2:1,13),FILL=X'FF'
JOIN UNPAIRED
SORT FIELDS=(1,4,CH,A,6,9,CH,A)
OUTFIL INCLUDE=(1,1,BI,NE,X'FF',AND,43,1,CH,NE,X'FF'),
OUTREC=(1,15,16:47,9,25,18)
//*
Thanks,
Venkat
Back to top
Alissa Margulies SYNCSORT Support Joined: 25 Jul 2007Posts: 496 Location: USA
Back to top
enrico-sorichetti Superior Member Joined: 14 Mar 2007Posts: 10873 Location: italy
Quote:
....This appears to be the same question ....
Yess! that' s the reason for my mild warning
Back to top
sub7 New User Joined: 12 Sep 2005Posts: 9
Thanks to Venkat and Alissa . In fact I reached the same solution which Alisaa has proposed using Venkat's code !!
Enrico my bad again.Hope you will forgive !!!!
-Neo.
Back to top
Please enable JavaScript!