Need Help in copying two fields from 2 files to a 3rd file.

In this Mainframe Forum - You can post your queries on DFSORT, ICETOOL , SyncSort & JCL Utilities

Moderators: Frank Yaeger, Moderator Group

Post Reply
sathyasurya
Member
Posts: 2
Joined: Mon Jun 24, 2013 7:13 pm

Need Help in copying two fields from 2 files to a 3rd file.

Post by sathyasurya » Mon Jun 24, 2013 7:31 pm

Dear All,
I Need a help in copying two fields from 2 different fields and pasting it into the 3rd file.

The input files have the Config Parameter as RECFM=FB, LRECL=80.
I do not want to write any Program in COBOL or any REXX to achieve the below,

I can only use SORT program to attain this.

Contents of my input file 'File 1' and 'File 2' are provided as below

File 1:
==MSG> your edit profile using the
000001 LOGON TDPM/LOAD_UK_WID05DNQ_U01,
000002 LOGON TDPM/LOAD_UK_WID05DNQ_U01,
000003 LOGON TDPM/LOAD_UK_WID05DNQ_U01,
000004 LOGON TDPM/LOAD_UK_WID05DNQ_U01,

File 2:
000001 18 // DD DISP=SHR,DSN=XX.PROD.LIVE.TDS(WID05Q1D)
000002 25 // DD DISP=SHR,DSN=XX.PROD.LIVE.TDS(WID05Q2D)
000003 33 // DD DISP=SHR,DSN=XX.PROD.LIVE.TDS(WID05Q3D)
000004 40 // DD DISP=SHR,DSN=XX.PROD.LIVE.TDS(WID05Q4D)

From the above input files, I want the output file should have contents
000001 LOGON TDPM/LOAD_UK_WID05DNQ_U01,WID05Q1D
000002 LOGON TDPM/LOAD_UK_WID05DNQ_U01,WID05Q2D
000003 LOGON TDPM/LOAD_UK_WID05DNQ_U01,WID05Q3D
000004 LOGON TDPM/LOAD_UK_WID05DNQ_U01,WID05Q4D


Note: there is no Key field in matching records between 2 files,
The requirement here is to concatenate the records in the 1st file with the particular String(of 8 chars Length eg: WID05Q1D) from 2nd file into to 3rd file as above.

Kindly help me here
Thanks in Advance,
Sathiya.

DikDude
Moderator
Posts: 1001
Joined: Fri Jul 22, 2011 8:39 am
Location: usa

Post by DikDude » Mon Jun 24, 2013 8:09 pm

Will both files always have the same number of records and contain no duplicates?

If yes, generate a sequence number in both files, JOINKEYS on the sequence number and reformat the output as needed.
Have a good one

sathyasurya
Member
Posts: 2
Joined: Mon Jun 24, 2013 7:13 pm

Post by sathyasurya » Mon Jun 24, 2013 8:52 pm

Thanks for the reply,
if you could help me by providing the code,
Could you please provide me the JCL statements for this specific Requirement?
Thanks in Advance,
Sathiya.

NicC
Active Member
Posts: 650
Joined: Sun Jul 24, 2011 5:27 pm
Location: Down on the pig farm

Post by NicC » Mon Jun 24, 2013 10:53 pm

JCL statements are fairly bog-standard...ee
You need statement along the lines of:

Code: Select all

//STEPXYZ EXEC PGM=yoursortprogramname
//SYSOUT DD SYSOUT=*
//SYSIN DD *
your sort control cards go here
plus cards for each dataset as specified in the manual for your solution.

If you want code - how much can you pay?
Regards
Nic

William Collins
Active Member
Posts: 732
Joined: Thu May 24, 2012 4:07 am

Post by William Collins » Tue Jun 25, 2013 11:53 am

JOINKEYS has been suggested to you. Don't have a key? It has been suggested how you can make one.

If the member-name is in a fixed position, no problem. If in a variable position, look at PARSE.

There are examples: open a manual, type in an internet search.

Code: Select all

//JNF1CNTL DD *
  INREC OVERLAY=(81:sequence number of a length enough to comfortably number all your records)
INREC BUILD for the output you require.

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others