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

Adding 'ODD' and 'EVEN' indicator at each record


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
selvamsrinivasan85

New User


Joined: 09 Aug 2010
Posts: 31
Location: Chennai

PostPosted: Tue Apr 18, 2023 10:10 am
Reply with quote

Hi all,
I have to include Odd and Even indicator at each of every record. This is my requirement. Details given below.

Input: (FB/80 - 70 characters + 10 Spaces)
Record1
Record2
Record3
Record4

Output:(FB/80 - 71 characters + 9 spaces)
Record1O
Record2E
Record3O
Record4E

One way I did is
1. Splitting into 2 files
2. Building the record with Odd and Even indicator
3. Merging into Single file again.

Is there a way to do in a single step?.

Thanks,
Srinivasan Selvam
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


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

PostPosted: Tue Apr 18, 2023 11:03 am
Reply with quote

Provide the Code for what you have tried, please. Use code tags to format your input/output.
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


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

PostPosted: Tue Apr 18, 2023 11:20 am
Reply with quote

Code:
OPTION COPY                                               
INREC IFOUTLEN=80,IFTHEN=(WHEN=INIT,                       
  OVERLAY=(1,80,JFY=(SHIFT=RIGHT),                         
           81:SEQNUM,1,ZD,81:81,1,ZD,MOD,+2,TO=ZD,LENGTH=1,
           81:81,1,CHANGE=(1,C'1',C'O',C'0',C'E'),                 
           1:1,81,JFY=(SHIFT=LEFT,LENGTH=80)))                     
END

Output:
Code:
****** **************
000001 Record1O     
000002 Record2E     
000003 Record3O     
000004 Record4E     
****** **************
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


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

PostPosted: Tue Apr 18, 2023 12:55 pm
Reply with quote

If you only need the indicator at Pos #71, adapt the sample accordingly.
Code:
  OPTION COPY                                               
  INREC OVERLAY=(71:SEQNUM,1,ZD,71:71,1,ZD,MOD,+2,TO=ZD,LENGTH=1,
                 71:71,1,CHANGE=(1,C'1',C'O',C'0',C'E'))       
  END
Back to top
View user's profile Send private message
selvamsrinivasan85

New User


Joined: 09 Aug 2010
Posts: 31
Location: Chennai

PostPosted: Tue Apr 18, 2023 2:35 pm
Reply with quote

Hi Joerg,
Sorry for replying late.

Please find the steps given below.

Code:

//SPLITFL EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=TEST.INPUT1.PS,DISP=OLD
//STOUT1 DD DSN=TEST.SPLIT1.PS,DISP=(NEW,CATLG),
//        SPACE=(CYL,(5,5),RLSE),UNIT=SYSDA,
//        DCB=(RECFM=FB,LRECL=80,BLKSIZE=0)
//STOUT2 DD DSN=TEST.SPLIT2.PS,DISP=(NEW,CATLG),
//        SPACE=(CYL,(5,5),RLSE),UNIT=SYSDA,
//        DCB=(RECFM=FB,LRECL=80,BLKSIZE=0)
//SYSIN DD *
  SORT FIELDS=(1,5,CH,A)
  OUTFIL FNAMES=(STOUT1,STOUT2),SPLIT
/*
//APDODD EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=TEST.SPLIT1.PS,DISP=OLD
//SORTOUT DD DSN=TEST.SPLIT3.PS,DISP=(NEW,CATLG),
//        SPACE=(CYL,(5,5),RLSE),UNIT=SYSDA,
//        DCB=(RECFM=FB,LRECL=80,BLKSIZE=0)
//SYSIN DD*
  SORT FIELDS=COPY
  OUTREC BUILD=(1,70,C'O',80:X'40')
/*
//APDEVEN EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=TEST.SPLIT2.PS,DISP=OLD
//SORTOUT DD DSN=TEST.SPLIT4.PS,DISP=(NEW,CATLG),
//        SPACE=(CYL,(5,5),RLSE),UNIT=SYSDA,
//        DCB=(RECFM=FB,LRECL=80,BLKSIZE=0)
//SYSIN DD*
  SORT FIELDS=COPY
  OUTREC BUILD=(1,70,C'E',80:X'40')
/*
//SPLITFL EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=TEST.SPLIT3.PS,DISP=OLD
//       DD DSN=TEST.SPLIT4.PS,DISP=OLD
//SORTOUT DD DSN=TEST.SPLIT5.PS,DISP=(NEW,CATLG),
//        SPACE=(CYL,(5,5),RLSE),UNIT=SYSDA,
//        DCB=(RECFM=FB,LRECL=80,BLKSIZE=0)
//SYSIN DD *
  SORT FIELDS=(1,5,CH,A)
/*


Will give a try on your code and let you know.
Thank you!.
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


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

PostPosted: Tue Apr 18, 2023 2:45 pm
Reply with quote

Use the last sample I have provided. Thanks for sharing your code. It helped to understand the issue a bit better.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2018
Location: USA

PostPosted: Tue Apr 18, 2023 6:41 pm
Reply with quote

Joerg.Findeisen wrote:
If you only need the indicator at Pos #71, adapt the sample accordingly.
Code:
  OPTION COPY                                               
  INREC OVERLAY=(71:SEQNUM,1,ZD,71:71,1,ZD,MOD,+2,TO=ZD,LENGTH=1,
                 71:71,1,CHANGE=(1,C'1',C'O',C'0',C'E'))       
  END

One more option for this operation
Code:
  OPTION COPY   
  ALTSEQ CODE=(F1C5,F2D6)     '1'->'E', '2'->'O'                                             
  INREC  IFTHEN=(WHEN=GROUP,RECORDS=2,PUSH=(71:SEQ=1))
  OUTREC OVERLAY=(71:71,1,TRAN=ALTSEQ)       
  END
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts Adding QMF and SPUFI to the ISPF menu DB2 20
Search our Forums:

Back to Top