How to concatenate records from two ps into one ps?
Moderators: Frank Yaeger, DikDude, Moderator Group
How to concatenate records from two ps into one ps?
I have two ps in which:
One is having records like name of files in 1-20 columns and LRECL of the file is 80 and RECFM is FB.
Another one is having records like date when each file was processed in 1-20 columns and LRECL of the file is 80 and RECFM is FB.
I want to concatenate the records in two files in such a way that the name and the date in which that file was processed will come in same record.
as for example:
PS1:
uytreh.ijhdftg.gtyhkmn
retghb.iuhhhh.uhuhuhh
huhjhh.ujhjhju.uhjjhjhj
PS2:
2009-05-062009-09-05
2009-04-072009-02-06
2008-10-272009-04-12
Output:
uytreh.ijhdftg.gtyhkmn 2009-05-062009-09-05
retghb.iuhhhh.uhuhuhh 2009-04-072009-02-06
huhjhh.ujhjhju.uhjjhjhj 2008-10-272009-04-12
And I want to do all this using jcl utilities or dfsort.
The output file can be a new file or this can be modified in an old file.
Please give me some solution
One is having records like name of files in 1-20 columns and LRECL of the file is 80 and RECFM is FB.
Another one is having records like date when each file was processed in 1-20 columns and LRECL of the file is 80 and RECFM is FB.
I want to concatenate the records in two files in such a way that the name and the date in which that file was processed will come in same record.
as for example:
PS1:
uytreh.ijhdftg.gtyhkmn
retghb.iuhhhh.uhuhuhh
huhjhh.ujhjhju.uhjjhjhj
PS2:
2009-05-062009-09-05
2009-04-072009-02-06
2008-10-272009-04-12
Output:
uytreh.ijhdftg.gtyhkmn 2009-05-062009-09-05
retghb.iuhhhh.uhuhuhh 2009-04-072009-02-06
huhjhh.ujhjhju.uhjjhjhj 2008-10-272009-04-12
And I want to do all this using jcl utilities or dfsort.
The output file can be a new file or this can be modified in an old file.
Please give me some solution
-
- Member
- Posts: 4
- Joined: Tue Feb 24, 2009 3:54 pm
- Location: Pune
I don't think you can do it using only jcl utilities or sort. You will have to write a small application program because you are merging two saparate records from different files into a single record.
If you find such solution than please let me know at my mail
Shashank.Gite@Steria.co.in
If you find such solution than please let me know at my mail
Shashank.Gite@Steria.co.in
Cheers...
Shashank Gite
Shashank Gite
Concatenate both files together and using group function we can push the first record of first file on to the first record of second file.
You mentioned that second file only has only dates , so it is always numeric and the first file is dataset names and you cant have a numeric in them. So we check that and pad a seqnum to match. The dataset names can be a max of 44 bytes , so we put the dates in pos 46 of the output file
The following is the output from the job
You mentioned that second file only has only dates , so it is always numeric and the first file is dataset names and you cant have a numeric in them. So we check that and pad a seqnum to match. The dataset names can be a max of 44 bytes , so we put the dates in pos 46 of the output file
Code: Select all
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
UYTREH.IJHDFTG.GTYHKMN
RETGHB.IUHHHH.UHUHUHH
HUHJHH.UJHJHJU.UHJJHJHJ
// DD *
2009-05-062009-09-05
2009-04-072009-02-06
2008-10-272009-04-12
//SORTOUT DD SYSOUT=*
//SYSIN DD *
INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:C'1',SEQNUM,8,ZD)),
IFTHEN=(WHEN=(1,1,SS,EQ,C'1234567890'),
OVERLAY=(46:1,20,01:45X,81:C'2',SEQNUM,8,ZD,RESTART=(81,1)))
SORT FIELDS=(82,8,CH,A),EQUALS
OUTREC IFTHEN=(WHEN=GROUP,RECORDS=2,PUSH=(1:1,45))
OUTFIL BUILD=(1,80),OMIT=(81,1,ZD,EQ,1)
/*
The following is the output from the job
Code: Select all
UYTREH.IJHDFTG.GTYHKMN 2009-05-062009-09-05
RETGHB.IUHHHH.UHUHUHH 2009-04-072009-02-06
HUHJHH.UJHJHJU.UHJJHJHJ 2008-10-272009-04-12
Thanx skolusu
But the problem is that I don't have a fixed number of records in the file, it changes as per the files included in a cycle.
The only thing that is fixed is that both the files will have same number of records.
I think you got what I mean.
You can use icetool also but I don't want to use any programming language.
Please reply as soon as possible.
Its urgent.
The only thing that is fixed is that both the files will have same number of records.
I think you got what I mean.
You can use icetool also but I don't want to use any programming language.
Please reply as soon as possible.
Its urgent.
Re: Thanx skolusu
nidhi1985,nidhi1985 wrote:But the problem is that I don't have a fixed number of records in the file, it changes as per the files included in a cycle.
The only thing that is fixed is that both the files will have same number of records.
I think you got what I mean.
You can use icetool also but I don't want to use any programming language.
Please reply as soon as possible.
Its urgent.
what makes you think that my solution will NOT handle it ? Did you even run and see if it works?
Thanx skolusu
I will definitely try this
Thanx Skolusu,
The second file has only the names but the names are as such IHM.CXDTRN1.TRNSFR, so what I mean to say is that the file names too have numbers in them
And one more thing:
Can I mention the name of two files that I am using instead of copying data from them in SORTIN statement as:
//SORTIN1 DD DSN=dsn name1, DISP=shr
//SORTIN2 DD DSN=dsn name2, DISP=shr
Please clear up my doubts as I am not able to understand the full code.
And one more thing:
Can I mention the name of two files that I am using instead of copying data from them in SORTIN statement as:
//SORTIN1 DD DSN=dsn name1, DISP=shr
//SORTIN2 DD DSN=dsn name2, DISP=shr
Please clear up my doubts as I am not able to understand the full code.
It doesn't matter , as long as they are mainframe dataset names, the first alphabet can never be a number and I am only checking the first byte to see if it is a numbernidhi1985 wrote:The second file has only the names but the names are as such IHM.CXDTRN1.TRNSFR, so what I mean to say is that the file names too have numbers in them
If you read my post clearly you should have found thisnidhi1985 wrote:And one more thing:
Can I mention the name of two files that I am using instead of copying data from them in SORTIN statement as:
//SORTIN1 DD DSN=dsn name1, DISP=shr
//SORTIN2 DD DSN=dsn name2, DISP=shr
ie.Concatenate both files together and using group function we can push the first record of first file on to the first record of second file.
Code: Select all
//SORTIN DD DSN=your file with dataset names,DISP=SHR
// DD DSN=your file with numerical dates,DISP=SHR
For complete details on the new WHEN=GROUP and the other new functions available with PTF UK90013, see:
www.ibm.com/systems/support/storage/sof ... /mvs/ugpf/
Hi skolusu
I tried that jcl but
while doing a jjscan its giving me an error of severity 8
and that is
Parameter keyword records unidentified
Parameter keyword push unidentified
Please advice me what to do in this situation
while doing a jjscan its giving me an error of severity 8
and that is
Parameter keyword records unidentified
Parameter keyword push unidentified
Please advice me what to do in this situation
-
- Active Member
- Posts: 52
- Joined: Wed Mar 25, 2009 11:56 pm
- Location: Banglore
-
- Moderator
- Posts: 1625
- Joined: Sat Aug 09, 2008 9:02 am
- Location: Mumbai, India
nidhi1985,nidhi1985 wrote:while doing a jjscan its giving me an error of severity 8
Some of the third party jcl-check products are so outdated that they dont recognize some the keywords used in sort control statements. Try submitting the job and post the error messages from SYSOUT here if you come across any issues.
Arun
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
- Cobol Interview Questions
50+ Interview Questions - JCL Interview Questions
50+ Interview Questions - DB2 Interview Questions
100+ Interview Questions - CICS Interview Questions
70+ Interview Questions - VSAM Interview Questions
27 Interview Questions
Other References
Mainframe Tools and others
- XPEDITER Reference
Explains how we can debug a program - FILEAID Reference
Explains how to browse , edit and delete datasets - Change Man Reference
Quick Start tutorial on Changeman - Abend Reference
Important Abend codes explained - FaceBook Page
MainframeGurukul FaceBook Page - LinkedIn Page
MainframeGurkul Linkedin Page