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

Append the file-1 data to file-2 at record level


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   This topic is locked: you cannot edit posts or make replies.
View previous topic :: View next topic  
Author Message
sashi

New User


Joined: 14 Sep 2005
Posts: 54
Location: Chennai

PostPosted: Thu Nov 19, 2009 7:28 pm
Reply with quote

I have 2 files. FILE-1 has 100 records with LRECL=11 and FILE-2 has 100 records with LRECL=200. Both are FB format.
I need to create output file FILE-3 with 1 to 11 position data from FILE-1 and 12 to 211 data from FILE-2. I don’t have any key field in both the files.
In simple terms need to append each record from the FILE-1 to each record in FILE-2.

Ex:

FILE-1

B100407974
B100462036
B100594362

FILE-2
436 2410 164
804 2640 148
479 2605 154

FILE-3

B100407974 436 2410 164
B100462036 804 2640 148
B100594362 479 2605 154

Thanks
Sashi
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Thu Nov 19, 2009 8:08 pm
Reply with quote

This is a link to the DFSORT smart tricks documentation which has many examples of matching records, including matching records one to one without keys.

Please click HERE to access it.

Because the solution for sort related questions may vary from product to product, please ensure that you state clearly which sort product you are using.

If you are not sure, then by running a simple sort step shown below, you will be able to find out for yourself.

If the messages start with ICE then your product is DFSORT. Please also post the output of the complete line which has a message code ICE201I, as this will enable our DFSORT experts to determine which release of DFSORT that you have installed. This may also affect the solution offered.

If the messages start with WER or SYT then the product is SYNCSORT and should be posted in the JCL forum. Please also post the information telling which version of SYNCSORT is installed, as this may also affect the solution offered.

Thank you for taking your time to ensure that the valuable time of others is not wasted by offering inappropriate solutions which are not relevant due to the sort product being used and/or the release that is installed in you site.

Code:
//SORTSTEP EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SORTIN   DD *
ABC
//SORTOUT  DD SYSOUT=*
//SYSIN    DD *
  SORT     FIELDS=COPY
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu Nov 19, 2009 9:50 pm
Reply with quote

sashi,

With z/OS DFSORT V1R5 PTF UK51706 or z/OS DFSORT V1R10 PTF UK51707, you can use the Joinkeys function like shown below to get the desired results. Since both files don't have a common key we add a SEQNUM at the end of each file using INREC for each file via JNF1CNTL and JNF2CNTL and use that as a key for matching

Code:

//STEP0100 EXEC PGM=SORT                                 
//SYSOUT   DD SYSOUT=*                                   
//SORTJNF1 DD DSN=your FB 200 byte file,DISP=SHR         
//SORTJNF2 DD DSN=your FB 11 byte file,DISP=SHR           
//SORTOUT  DD SYSOUT=*                                   
//SYSIN    DD *                                           
  SORT FIELDS=COPY                                       
  JOINKEYS FILE=F1,FIELDS=(201,8,A),SORTED,NOSEQCK       
  JOINKEYS FILE=F2,FIELDS=(12,8,A),SORTED,NOSEQCK         
  REFORMAT FIELDS=(F2:1,11,F1:1,200)                     
//JNF1CNTL DD *                                           
  INREC OVERLAY=(201:SEQNUM,8,ZD)                         
//JNF2CNTL DD *                                           
  INREC OVERLAY=(12:SEQNUM,8,ZD)                         
//*


For complete details on Joinkey functions and the other new functions available with the Nov, 2009 DFSORT PTF, see:

www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000174
Back to top
View user's profile Send private message
Gursharan Khalsa

New User


Joined: 04 Sep 2007
Posts: 33
Location: Salinas

PostPosted: Mon Dec 28, 2009 1:08 pm
Reply with quote

Hi,
I have two files A1 and A2.My requirement is to copy only ACCOUNT field form A1 and paste it to ACCOUNT filed in A2,without making any changes to other fileds in A2.In simple terms I want to replace accounts present in A2 with those present in A1.Both files have different formats,A1 is a VSAM file and A2 is a flat file.

Thanx in advance
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Mon Dec 28, 2009 11:22 pm
Reply with quote

Gursharan Khalsa,

I'm locking this topic.

Please start a new topic for this new question with more information on what you want to do:

Show an example of the records in each input file (relevant fields only) and what you expect for output. Explain the "rules" for getting from input to output. Give the starting position, length and format of each relevant field. Give the RECFM and LRECL of the input files. If file1 can have duplicates within it, show that in your example. If file2 can have duplicates within it, show that in your example.

Also, indicate if you have the Nov, 2009 DFSORT PTF so I can tell if you can use JOINKEYS or not. To find out if you have the 2009 PTF, follow the instructions at:

ibmmainframes.com//viewtopic.php?t=33389
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   This topic is locked: you cannot edit posts or make replies. View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Binary File format getting change whi... All Other Mainframe Topics 7
No new posts How to save SYSLOG as text data via P... All Other Mainframe Topics 4
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Store the data for fixed length COBOL Programming 1
Search our Forums:

Back to Top