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

write records b/w the records


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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: 2455
Location: Hampshire, UK

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

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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Sat Sep 08, 2012 12:26 am
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Sat Sep 08, 2012 3:28 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Join multiple records using splice DFSORT/ICETOOL 5
No new posts EZT program to build a flat file with... All Other Mainframe Topics 9
Search our Forums:

Back to Top