|
View previous topic :: View next topic
|
| Author |
Message |
saranyan_j
New User
Joined: 24 May 2006 Posts: 7
|
|
|
|
I have an input file which is an FB (1500 LRECL). My point of interest are two fields in them.
1. Reference number
2. Flag which needs to be set the same for the a given reference number.
The input file would like this
Input File
D1234567.........R.......
D1234567.........R.......
D1234567.........X.......
D1234567.........L.......
D1234568.........L.......
D1234568.........X.......
D1234568.........L.......
D1234568.........L.......
D1234569.........L.......
D1234569.........L.......
D1234569.................
As you can see the first 8 chars are the reference numbers which are sorted and the single byte char (which contains 'R' or 'X' or 'L' ) are the flags to be set. It would be required that all records of a specific reference number to be set with one single flag.
All records to be filled with 'R' if any one of the record contains 'R'
All records to be filled with 'X' if any one of the record contains 'X' and none of them have an 'R'
All records to be filled with 'L' if any one of the record contains 'L' and none of them have an 'R' or an 'X'.
Essentially the output record should be as below
D1234567.........R.......
D1234567.........R.......
D1234567.........R.......
D1234567.........R.......
D1234568.........X.......
D1234568.........X.......
D1234568.........X.......
D1234568.........X.......
D1234569.........L.......
D1234569.........L.......
D1234569.........L.......
I would like the above to be done with DFSORT ( ICETOOL ).
Saran |
|
| Back to top |
|
 |
expat
Global Moderator

Joined: 14 Mar 2007 Posts: 8798 Location: Welsh Wales
|
|
|
|
Because the solution for sort related questions may vary from product to product, please ensure that you state clearly which sort product you are using.
If you are not sure, then by running a simple sort step shown below, you will be able to find out for yourself.
If the messages start with ICE then your product is DFSORT. Please also post the output of the complete line which has a message code ICE201I, as this will enable our DFSORT experts to determine which release of DFSORT that you have installed. This may also affect the solution offered.
If the messages start with WER or SYT then the product is SYNCSORT and will be moved into the JCL forum by one of the moderators. Please also post the information telling which version of SYNCSORT is installed, as this may also affect the solution offered.
Thank you for taking your time to ensure that the valuable time of others is not wasted by offering inappropriate solutions which are not relevant due to the sort product being used and/or the release that is installed in you site.
| Code: |
//SORTSTEP EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
ABC
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY |
|
|
| Back to top |
|
 |
saranyan_j
New User
Joined: 24 May 2006 Posts: 7
|
|
|
|
Im sorry for not being specific before. We use product DFSORT and the line containing ICE201I is below
ICE201I G RECORD TYPE IS F - DATA STARTS IN POSITION 1 |
|
| Back to top |
|
 |
Escapa
Senior Member

Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
Hi Saran,
Below sortstep will give you desired output...
| Code: |
//S1 EXEC PGM=SORT
//SORTIN DD *
D1234567.........R.......
D1234567.........R.......
D1234567.........X.......
D1234567.........L.......
D1234568.........L.......
D1234568.........X.......
D1234568.........L.......
D1234568.........L.......
D1234569.........L.......
D1234569.........L.......
D1234569.................
//SORTOUT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=(1,8,CH,A,1501,1,CH,A)
INREC IFTHEN=(WHEN=(18,1,CH,EQ,C'R'),OVERLAY=(1501:C'1')),
IFTHEN=(WHEN=(18,1,CH,EQ,C'X'),OVERLAY=(1501:C'2')),
IFTHEN=(WHEN=(18,1,CH,EQ,C'L'),OVERLAY=(1501:C'3')),
IFTHEN=(WHEN=NONE,OVERLAY=(1501:C'4'))
OUTREC IFTHEN=(WHEN=INIT,OVERLAY=(1502:SEQNUM,8,ZD,RESTART=(1,8))),
IFTHEN=(WHEN=GROUP,BEGIN=(1502,8,ZD,EQ,1),PUSH=(18:18,1))
OUTFIL BUILD=(1,1500)
/*
|
Output will be...
| Code: |
D1234567.........R.......
D1234567.........R.......
D1234567.........R.......
D1234567.........R.......
D1234568.........X.......
D1234568.........X.......
D1234568.........X.......
D1234568.........X.......
D1234569.........L.......
D1234569.........L.......
D1234569.........L.......
|
|
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|