Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

write records b/w the records

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
shanth555

New User


Joined: 17 Aug 2012
Posts: 35
Location: India

PostPosted: Fri Sep 07, 2012 8:17 pm    Post subject: write records b/w the records
Reply with quote

i have 3 datasets which having different values.

1st dataset

Code:

000033.00


2nd dataset
Code:

45000.00


3rd dataset
Code:

450.00


the above values should copy and insert into another dataset which aleady have values.

the current output dataset:

Code:

AA BB CC


Expected output dataset.

Code:

AA 000033.00  BB 45000.00 CC 450.00


Kindly let me know which sort can be used for this
Back to top
View user's profile Send private message

Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 1825
Location: UK

PostPosted: Fri Sep 07, 2012 8:36 pm    Post subject:
Reply with quote

Presumably SYNCSORT?
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Sat Sep 08, 2012 12:26 am    Post subject: Reply to: write records b/w the records
Reply with quote

If Syncsort, what version?

If you "fake" a match for the records (append the same value to all four) then you can have a look at JOINKEYS, perhaps with WHEN=GROUP.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Sat Sep 08, 2012 3:28 pm    Post subject: Reply to: write records b/w the records
Reply with quote

Here's one way. In DFSORT. You'll need the JNFnCNTL files, so if you don't have them, talk to Syncsort support. If you get nowhere there, do that work in two separate steps before the join.

Concatenate your three single-number files. Use JOINKEYS. Append something to each record of each file (I used zero). Append sequence number to number records. JOINKEYS on the appended value. Three GROUPs to pass the "different" pieces of data down, defined on the sequence number. OUTFIL INCLUDE for the third record, as the first two are incomplete "work" records.

If you get it working, make sure you fully understand and document it.

Code:
//MERGEDAT EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SORTOUT  DD SYSOUT=*
//SYSIN    DD *
  OPTION COPY
  JOINKEYS F1=INA,FIELDS=(9,1,A),SORTED,NOSEQCK
  JOINKEYS F2=INB,FIELDS=(10,1,A),SORTED,NOSEQCK
  REFORMAT FIELDS=(F1:1,9,F2:1,9,11,1)
  INREC IFTHEN=(WHEN=INIT,BUILD=(1,3,10,9,X,4,3,9X,X,7,2,X,9X,19,1)),
        IFTHEN=(WHEN=GROUP,BEGIN=(39,1,CH,EQ,C'3'),RECORDS=1,
                 PUSH=(30:4,9)),
        IFTHEN=(WHEN=GROUP,BEGIN=(39,1,CH,EQ,C'2'),RECORDS=2,
                 PUSH=(17:4,9)),
        IFTHEN=(WHEN=GROUP,BEGIN=(39,1,CH,EQ,C'1'),RECORDS=3,
                 PUSH=(4:4,9))
  OUTFIL INCLUDE=(39,1,CH,EQ,C'3'),BUILD=(1,38)
//JNF1CNTL DD *
  OPTION COPY
  INREC OVERLAY=(9:C'0')
//JNF2CNTL DD *
  OPTION COPY
  INREC OVERLAY=(10:C'0',SEQNUM,1,ZD)
//INA      DD *
AA BB CC
//INB      DD *
000033.00
45000.00
450.00


Output:

Code:
AA 000033.00 BB 45000.00  CC 450.00   
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Write out NODUPS but just from one file Jay Villaverde DFSORT/ICETOOL 8 Fri Jul 14, 2017 12:44 am
No new posts How to write Specific Fields from Mul... Padhu SYNCSORT 6 Thu Jul 06, 2017 10:26 am
No new posts Need to write record of PS File in ex... Chandan1993 JCL & VSAM 1 Wed Jun 07, 2017 1:35 am
No new posts Check if any Detail records and extra... V S Amarendra Reddy SYNCSORT 19 Mon May 08, 2017 8:54 pm
No new posts Join giving more records than expected Danielle.Filteau SYNCSORT 2 Thu Mar 09, 2017 3:28 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us