IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to remove one row and can be added in a certain place


IBM Mainframe Forums -> All Other Mainframe Topics
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Bodhi76

New User


Joined: 10 Mar 2022
Posts: 1
Location: India

PostPosted: Thu Mar 10, 2022 8:15 pm
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8697
Location: Dubuque, Iowa, USA

PostPosted: Thu Mar 10, 2022 8:25 pm
Reply with quote

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
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1256
Location: Bamberg, Germany

PostPosted: Fri Mar 11, 2022 5:11 am
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> All Other Mainframe Topics

 


Similar Topics
Topic Forum Replies
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts Remove leading zeroes SYNCSORT 4
No new posts How to remove block of duplicates DFSORT/ICETOOL 8
No new posts To Remove spaces (which is in hex for... JCL & VSAM 10
No new posts How to remove spaces in between. SYNCSORT 12
Search our Forums:

Back to Top