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
 
Append the file-1 data to file-2 at record level

 
Post new topic   This topic is locked: you cannot edit posts or make replies.    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Append the file-1 data to file-2 at record level
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: 8593
Location: Back in jolly old England

PostPosted: Thu Nov 19, 2009 8:08 pm    Post subject:
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    Post subject:
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:

http://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    Post subject: Copying selected data from one file to another
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 Moderator


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

PostPosted: Mon Dec 28, 2009 11:22 pm    Post subject:
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:

http://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.    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 Copy 4 byte of data from the last rec... arunsoods DFSORT/ICETOOL 9 Fri Oct 06, 2017 12:15 pm
No new posts opening a dataset after reading it fr... arunsoods DFSORT/ICETOOL 5 Wed Oct 04, 2017 3:54 pm
No new posts Execute JCL step based on the content... sprikitik JCL & VSAM 2 Tue Oct 03, 2017 10:03 am
This topic is locked: you cannot edit posts or make replies. PS file data should be passed as symb... d_sarlie JCL & VSAM 15 Tue Oct 03, 2017 5:18 am
No new posts Garbage on output file Hervey Martinez SYNCSORT 4 Wed Sep 27, 2017 12:50 am

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