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

Need to split single line into two lines and replace string


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

New User


Joined: 04 Nov 2020
Posts: 3
Location: India

PostPosted: Wed Nov 04, 2020 11:58 pm
Reply with quote

I have a dynamically created input file which has transmission job details, I need to replace the node with my node and also the folder path with my path, I am able to achieve the replacement of node with IFTHEN/OVERLAY option but while doing same for folder path but it is going beyond 70 as the folder path is long , I tried splitting the line or replacing the path its not working. file is LRECL 70 FB.
Starting position is 3. Please help.

My input file has below records
Code:

SIGNON CASE=YES                                   
SUBMIT PROC=ZZZZZZZZ                              -
PNODE=NODE1                                       -
SNODE=AAAAAAAAAAAA                                -
NEWNAME=BBBBBBBB                                  -
&DSN1=TEMP.VB.DELTA                               -
&DSN2='eeeeeeeee/ABCD_D20201101_S01431_X_Y1_Z'    -
&COMP=COMPRESS                                    -
&EXT=EXT                                           
SIGNOFF


Expected output file -

Code:
SIGNON CASE=YES                                   
SUBMIT PROC=ZZZZZZZZ                           -
PNODE=NODE1                                           -
SNODE=YYYYYYYYYYYY                                -
NEWNAME=BBBBBBBB                                 -
&DSN1=TEMP.VB.DELTA                               -
&DSN2=\'/aaaa/bbbbbbb/cd/ddddd/eeeeeeeee/ffffff/\   || -
       \ABCD_D20201101_S01431_X_Y1_Z'\            -
&COMP=COMPRESS                                    -
&EXT=EXT                                           
SIGNOFF

Cod'ed
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3051
Location: NYC,USA

PostPosted: Thu Nov 05, 2020 2:00 am
Reply with quote

Welcome !!
Please make a use of Code tags. You can post what you tried instead of saying it. Second, confirm if this is what you want -
Find &DSN2= and push the current value to next line and add the one that you have hardcoded? It doesn't match in your example above as /fffffff/ is added after /eeeeeeeee/ in expected results.

You can think of using INREC IFTHEN=(WHEN=Condition, PUSH whatever is after &DSN2=)
in OUTREC you can BUILD using '/' operator to get the push'd value on to second line eliminating blank records.

Or
I believe, You can achieve using JOINKEYS too:)
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


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

PostPosted: Thu Nov 05, 2020 11:04 am
Reply with quote

Rohit Umarjikar wrote:
..in OUTREC you can BUILD using '/' operator to get the push'd value on to second line eliminating blank records.

This should work w/ OUTFIL but never in OUTREC.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3051
Location: NYC,USA

PostPosted: Thu Nov 05, 2020 6:14 pm
Reply with quote

That’s right OUTFIL, it’s one of those auto spells🙂. Thanks Joerg.
Back to top
View user's profile Send private message
sonali L tambade

New User


Joined: 04 Nov 2020
Posts: 3
Location: India

PostPosted: Thu Nov 05, 2020 7:31 pm
Reply with quote

Thanks for your replies, I was able to achieve the split of line with below and get it into output file-

INPUT - &DSN2='testflder/TEST_D20201101_S01431_C_P1_D' -

OUTPUT -
&DSN2='testflder/
TEST_D20201101_S01431_C_P1_D' -

SORT FIELDS=COPY
OUTFIL IFTHEN=(WHEN(10,10,CH,EQ,C'gcdudaily/'),
BUILD=(1,19,70:X,/,20,47))

Now I want to reformat below input

INPUT -

&DSN2='testflder/
TEST_D20201101_S01431_C_P1_D' -

Expected output -

&DSN2=\'/data/test/cd/DEV/testfolder/upload/\ || -
\TEST_D20201101_S01431_C_P1_D'\ -

I used below sort card but its not working, also I am not sure how to apen slash at the start and end of TEST_D20201101_S01431_C_P1_D
Please give some idea


//CTL1CNTL DD *
OPTION COPY
INREC IFOUTLEN=70,
IFTHEN=(WHEN(10,9,CH,EQ,C'testfolder'),
OVERLAY=(10:C'\'/data/test/cd/DEV/testfolder/upload/\ || -'))
/*

Thanks in advance for helping out
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


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

PostPosted: Thu Nov 05, 2020 7:51 pm
Reply with quote

Use code tags when presenting code and data!

Code:
//SPLITREP EXEC PGM=ICEMAN
//SORTIN   DD *                                                   
&DSN2='eeeeeeeee/ABCD_D20201101_S01431_X_Y1_Z'    -               
/*                                                                 
//SYSOUT   DD SYSOUT=*                                             
//SORTOUT  DD SYSOUT=*                                             
//SYSIN    DD *                                                   
  OPTION COPY                                                     
  OUTFIL FNAMES=(SORTOUT),                                         
    IFTHEN=(WHEN=(1,6,CH,EQ,C'&DSN2='),                           
      PARSE=(%01=(STARTAFT=C'''',ENDBEFR=C'/',FIXLEN=60),         
             %02=(ENDBEFR=C'''',FIXLEN=60)),                       
      BUILD=(C'&DSN2=\''/aaaa/bbbbbbb/cd/ddddd/',                 
             C'eeeeeeeee/ffffff/\ !! -',/,                         
             %02,SQZ=(SHIFT=LEFT,LEAD=C'      ',TRAIL=C'''\ -',   
                      LENGTH=60)))                                 
  END                                                             
/*


No need to use ICETOOL, it's a simple task.
Back to top
View user's profile Send private message
sonali L tambade

New User


Joined: 04 Nov 2020
Posts: 3
Location: India

PostPosted: Thu Nov 05, 2020 10:45 pm
Reply with quote

Thanks a Ton! Joerg. It worked! got the expected output
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2017
Location: USA

PostPosted: Fri Nov 06, 2020 6:10 am
Reply with quote

The same story, again, and again: any advice given to new-coming “experts” is 100% ignored. They are waiting ONLY for a ready to copy-and-paste solution presented to them after all. Next step: “Thank you, Mr. Expert, it worked fine!” And after a short period of time the next question is posted here, to help with his new job assignment, and rather to do his job for him, free of charge... icon_axe.gif icon_pray.gif 12.gif
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 Replace each space in cobol string wi... COBOL Programming 3
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
Search our Forums:

Back to Top