|
View previous topic :: View next topic
|
| Author |
Message |
Bodhi76
New User

Joined: 10 Mar 2022 Posts: 1 Location: India
|
|
|
|
I have one input file which have unique ID.
Requirement: every 4th and 5th line having 0255 record should remove from there and should be added after 6th line. Means first three 0255 records should be together. Last two 0255 records should kept as it is.
ID: Position 1-4
REC-CD: POS 6-9
one more field is there position 11 to 14. Value for this field is 0100 for first three 0255 records, rest of the first 3 0255 records the value is 9900.
Input:
AAA1 0010
AAA1 0080
AAA1 0255 0100
AAA1 0255 0100
AAA1 0110
AAA1 0332
AAA1 0255 0100
AAA1 0220
AAA1 0030
AAA1 0332
AAA1 0255 9900
AAA1 0255 9900
Required Output:
AAA1 0010
AAA1 0080
AAA1 0110
AAA1 0332
AAA1 0255 0100
AAA1 0255 0100
AAA1 0255 0100
AAA1 0220
AAA1 0030
AAA1 0332
AAA1 0255 9900
AAA1 0255 9900
|
|
| Back to top |
|
 |
Robert Sample
Global Moderator

Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
| Quote: |
| I have one input file which have unique ID. |
The data you posted does not show any unique ID as every record has duplicated fields.
| Quote: |
| every 4th and 5th line having 0255 record |
Your posted input shows the 3rd and 4th lines have 0255, not the 4th and 5th.
Since you cannot even properly state your problem, exactly how do you expect us to help you?
And terminology is critical in IT, where similar terms may mean very different things. On the mainframe, there are data sets (not files) which have records (not lines). Your title mentions "rows", which is a term very specifically used for data bases (such as DB2) and not for data sets. So by your misuse of terminology you have completely muddled what you have here -- data set? data base? Who knows?
Also, use the Code button when posting data as it preserves spacing, which can be very important at times. |
|
| Back to top |
|
 |
Joerg.Findeisen
Senior Member

Joined: 15 Aug 2015 Posts: 1442 Location: Bamberg, Germany
|
|
|
|
| Code: |
//WHATEVER EXEC PGM=ICEMAN
//SORTIN DD *
AAA1 0010
AAA1 0080
AAA1 0255 0100
AAA1 0255 0100
AAA1 0110
AAA1 0332
AAA1 0255 0100
AAA1 0220
AAA1 0030
AAA1 0332
AAA1 0255 9900
AAA1 0255 9900
AFFE 0001
AFFE 0003
AFFE 0255 0100
AFFE 0255 0100
AFFE 0004
AFFE 0044
AFFE 0404
AFFE 4004
AFFE 4444
AFFE 0255 0100
AFFE 0255 9900
AFFE 0255 9900
/*
//SYSOUT DD SYSOUT=*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=INIT,OVERLAY=(30:SEQNUM,4,ZD,RESTART=(1,4)))
OUTFIL FNAMES=(SORTOUT),
OMIT=(6,9,CH,EQ,C'0255 0100',AND,30,4,ZD,LE,+6),
REMOVECC,
IFTHEN=(WHEN=(6,9,CH,EQ,C'0255 0100'),
BUILD=(1,29,/,1,29,/,1,29)),
IFTHEN=(WHEN=NONE,BUILD=(1,29))
END
/* |
Output:
| Code: |
****** ***************
000001 AAA1 0010
000002 AAA1 0080
000003 AAA1 0110
000004 AAA1 0332
000005 AAA1 0255 0100
000006 AAA1 0255 0100
000007 AAA1 0255 0100
000008 AAA1 0220
000009 AAA1 0030
000010 AAA1 0332
000011 AAA1 0255 9900
000012 AAA1 0255 9900
000013 AFFE 0001
000014 AFFE 0003
000015 AFFE 0004
000016 AFFE 0044
000017 AFFE 0404
000018 AFFE 4004
000019 AFFE 4444
000020 AFFE 0255 0100
000021 AFFE 0255 0100
000022 AFFE 0255 0100
000023 AFFE 0255 9900
000024 AFFE 0255 9900
****** *************** |
|
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|