Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Need Help to Create 4 Output Records for each Input Record

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
satish.ms10

Active User


Joined: 10 Aug 2009
Posts: 167
Location: India

PostPosted: Thu Jul 19, 2018 1:55 am    Post subject: Need Help to Create 4 Output Records for each Input Record
Reply with quote

Hi There,

Many thanks for you kind support thru this forum.

I have a requirement to create 4 output records for each input record. My requirement is, I have a input like

Code:
ABD HEADER ROW
   1111.111.1111
   2222.22.222222
   3333.333.333


And my expected output is

Code:
ABD HEADER ROW
     FROM DSN=1111.111.1111
     SRC=A1B2C3
     TO     DSN=AES.111.1111.D
     TGT=A7B8C9
     FROM DSN=2222.22.222222
     SRC=A1B2C3
     TO     DSN=AES.22.222222.D
     TGT=A7B8C9
     FROM DSN=3333.333.333
     SRC=A1B2C3
     TO     DSN=AES.333.333.D
     TGT=A7B8C9


I tried INREC-BUILD and OUTREC-WHEN-BUILD options but no luck. With INREC BUILD, I am able to add "1234" but OUTREC option copying only first output line.

Due to security and access restrictions, I am unable to provide my tried solution here. Could someone please help in this regard or guide which DFSORT options I should use to get desired output.

Kindly let me know if you need any additional details.

Thanks in advance.
Back to top
View user's profile Send private message

RahulG31

Active User


Joined: 20 Dec 2014
Posts: 444
Location: USA

PostPosted: Thu Jul 19, 2018 2:06 am    Post subject: Reply to: Need Help to Create 4 Output Records for each Input Record
Reply with quote

Use the OUTFIL slash (/) operator to create new record/new lines in output.

.
Back to top
View user's profile Send private message
satish.ms10

Active User


Joined: 10 Aug 2009
Posts: 167
Location: India

PostPosted: Thu Jul 19, 2018 2:24 am    Post subject:
Reply with quote

Hi Rahul,

Thanks for your quick reply.

I have created below sort card but unable to test it since I am not in office.

Code:
OPTIONS COPY
INREC IFTHEN=(WHEN=(1,1,NE,C' '),BUILD=(1,80,81,C'1'))
OUTFIL IFTHEN=(WHEN=(81,1,CH,EQ,C'1'),     
         BUILD=(1,C'     FROM DSN=',14:1,80,/,
         C'   SRC=A1B2C3',80:X),HIT=NEXT),
         IFTHEN=(WHEN=(1,14,CH,EQ,C'  C'TEST'),     
         BUILD=(1,C'   TO     DSN=',14:1,80,/,
         C'   TGT=A7B8C9',80:X))


Will you be able to validate my sort card.

By the way, my desired out is like below. I am really sorry for the mistake in my first post.

Code:
ABD HEADER ROW
     FROM DSN='1111.111.1111' -
     SRC=A1B2C3 -
     TO   DSN='AES.111.1111.D' -
     TGT=A7B8C9
     FROM DSN='2222.22.222222
     SRC=A1B2C3 -
     TO   DSN='AES.22.222222.D -
     TGT=A7B8C9
     FROM DSN='3333.333.333' -
     SRC=A1B2C3 -
     TO   DSN='AES.333.333.D' -
     TGT=A7B8C9


My question is how can I trim/strip leading spaces from my input record and add single quotes.

Please advise.

Thanks again.
Back to top
View user's profile Send private message
RahulG31

Active User


Joined: 20 Dec 2014
Posts: 444
Location: USA

PostPosted: Thu Jul 19, 2018 2:51 am    Post subject: Reply to: Need Help to Create 4 Output Records for each Input Record
Reply with quote

To insert single quote you'll use C'''' i.e. 4 single quotes

If your input is like this:
Code:
ABD HEADER ROW
    1111.111.1111
    2222.222.2222
    3333.333.3333


Then you can try something like this:
Code:
 OUTFIL IFTHEN=(WHEN=(1,1,CH,EQ,C' '),
     BUILD=(1:4C' ',5:C'FROM DSN=',14:C'''',5,13,28:C'''',/,
            1:4C' ',5:C'SRC=A1B2C3',/,
            1:4C' ',5:C'TO   DSN=',14:C'''',15:C'AES.',5,13,32:C'''',/,
            1:4C' ',5:C'TGT=A7B8C9'))
 OPTION COPY


To get Output like this:
Code:
ABD HEADER ROW
    FROM DSN='1111.111.1111'
    SRC=A1B2C3
    TO   DSN='AES.1111.111.1111'
    TGT=A7B8C9
    FROM DSN='2222.222.2222'
    SRC=A1B2C3
    TO   DSN='AES.2222.222.2222'
    TGT=A7B8C9
    FROM DSN='3333.333.3333'
    SRC=A1B2C3
    TO   DSN='AES.3333.333.3333'
    TGT=A7B8C9


.
Back to top
View user's profile Send private message
sergeyken

Active User


Joined: 29 Apr 2008
Posts: 367
Location: Maryland

PostPosted: Thu Jul 19, 2018 3:50 am    Post subject:
Reply with quote

Usually the field positions for input data of this type are varying. In order to provide flexible way of extraction from input data (e.g. names in this case) the parameter PARSE is highly desired in INREC/OUTREC/OUTFIL statements of SORT. Otherwise customization is needed before each run of this job, and this "automated solution" would need more efforts than manual typing of required output.
Back to top
View user's profile Send private message
satish.ms10

Active User


Joined: 10 Aug 2009
Posts: 167
Location: India

PostPosted: Tue Aug 07, 2018 2:33 am    Post subject:
Reply with quote

Hi There,

Sorry for the delayed update. I have tweaked my input a little and my expected output.

Input:
Code:
ABD HEADER ROW
X12345678.111.1111
X12345678.22.222222
X12345678.333.333


Expected Output:
Code:
ABD HEADER ROW
CPY0001  COPY FROM (DSN='12345678.111.1111' -
         DISP=SHR) -
         TO (DSN='TXT.111.1111' -
         DISP=NEW)
CPY0002  COPY FROM (DSN='1234567822.222222' -
         DISP=SHR) -
         TO (DSN='TXT.22.222222' -
         DISP=NEW)
CPY0003  COPY FROM (DSN='12345678.333.333' -
         DISP=SHR) -
         TO (DSN='TXT.333.333' -
         DISP=NEW)


Thanks Rahul and Frank (for JFY option from other post) for your inputs. I could able to achieve my requirement with below sort card.

Code:
OPTIONS COPY
INREC IFTHEN=(WHEN=(1,1,EQ,C'X'),
              BUILD=(1,80,81:SEQNUM,4,ZD,START=1,INCR=1))
OUTFIL IFTHEN=(WHEN=(1,1,CH,EQ,C'X'),     
         BUILD=(C'CPY'4:81,4,C' COPY FROM (DSN=',
                24:2,79,JFY=(SHIFT=LEFT,LEAD=C'''',TRAIL=C''' -'),/,
                C'       DISP=SHR)     -',/,
                C'       TO (DSN=',
                17:10,71,JFY=(SHIFT=LEFT,LEAD=C'''TXT.',TRAIL=C'.D'' -'),/,
                C'       DISP=NEW)'))


Note: Output positions may vary. I am unable to post exact input and out here.

Thanks again for your support.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Can records in IMS/DB be related usin... SRICOBSAS IMS DB/DC 2 Fri Oct 19, 2018 3:53 pm
This topic is locked: you cannot edit posts or make replies. Get value from 2nd record and PUSH it... ashokakash JCL & VSAM 1 Wed Oct 17, 2018 11:41 am
No new posts Merge data from record pairs ashokakash DFSORT/ICETOOL 5 Wed Oct 17, 2018 11:38 am
No new posts Process only last key record in a fil... Naveen.katkuri24 DFSORT/ICETOOL 8 Tue Oct 09, 2018 9:39 am
No new posts SYNCSORT keep MIN/MAX record Cloink SYNCSORT 16 Mon Sep 17, 2018 3:00 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us