How to concatenate records from two ps into one ps?

In this Mainframe Forum - You can post your queries on JCL, OS/390 JCL, MVS JCL, z/OS JCL, JES2 & JES3

Moderators: Frank Yaeger, DikDude, Moderator Group

nidhi1985
Member
Posts: 14
Joined: Mon Jun 15, 2009 3:40 pm

How to concatenate records from two ps into one ps?

Post by nidhi1985 » Tue Jun 16, 2009 10:27 am

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

Shashank Gite
Member
Posts: 4
Joined: Tue Feb 24, 2009 3:54 pm
Location: Pune

Post by Shashank Gite » Tue Jun 16, 2009 4:56 pm

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
Cheers...
Shashank Gite

skolusu
Member
Posts: 43
Joined: Sat Jul 26, 2008 12:38 am

Post by skolusu » Wed Jun 17, 2009 6:41 am

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

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
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

nidhi1985
Member
Posts: 14
Joined: Mon Jun 15, 2009 3:40 pm

Thanx skolusu

Post by nidhi1985 » Wed Jun 17, 2009 1:34 pm

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.

skolusu
Member
Posts: 43
Joined: Sat Jul 26, 2008 12:38 am

Re: Thanx skolusu

Post by skolusu » Wed Jun 17, 2009 8:53 pm

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.
nidhi1985,

what makes you think that my solution will NOT handle it ? Did you even run and see if it works?
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

nidhi1985
Member
Posts: 14
Joined: Mon Jun 15, 2009 3:40 pm

Thanx skolusu

Post by nidhi1985 » Thu Jun 18, 2009 12:19 pm

I will definitely try this

nidhi1985
Member
Posts: 14
Joined: Mon Jun 15, 2009 3:40 pm

Thanx Skolusu,

Post by nidhi1985 » Thu Jun 18, 2009 12:44 pm

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.

skolusu
Member
Posts: 43
Joined: Sat Jul 26, 2008 12:38 am

Post by skolusu » Thu Jun 18, 2009 8:53 pm

nidhi1985 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
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 number


nidhi1985 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
If you read my post clearly you should have found this
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.
ie.

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/
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

nidhi1985
Member
Posts: 14
Joined: Mon Jun 15, 2009 3:40 pm

Post by nidhi1985 » Fri Jun 19, 2009 5:05 pm

Thanks

nidhi1985
Member
Posts: 14
Joined: Mon Jun 15, 2009 3:40 pm

Post by nidhi1985 » Fri Jun 19, 2009 5:07 pm

Thanks 4 clearing up my doubts

nidhi1985
Member
Posts: 14
Joined: Mon Jun 15, 2009 3:40 pm

hi skolusu

Post by nidhi1985 » Fri Jun 19, 2009 5:15 pm

Thanks for ur support

nidhi1985
Member
Posts: 14
Joined: Mon Jun 15, 2009 3:40 pm

Hi skolusu

Post by nidhi1985 » Mon Jun 22, 2009 11:20 am

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

maheshvamsi
Active Member
Posts: 52
Joined: Wed Mar 25, 2009 11:56 pm
Location: Banglore

Post by maheshvamsi » Mon Jun 22, 2009 1:17 pm

Could you please post JCL & Errors. So that it will be easy for everyone to check
Thanks

MaheshVamsi

Anuj Dhawan
Moderator
Posts: 1625
Joined: Sat Aug 09, 2008 9:02 am
Location: Mumbai, India

Post by Anuj Dhawan » Mon Jun 22, 2009 4:22 pm

Parameter keyword records unidentified
Parameter keyword push unidentified
If you are a DFSORT user you are missing PTF supporting PUSH parameter. Or id you are a SYncSort user which version of it?
Regards,
Anuj

User avatar
arcvns
Member
Posts: 28
Joined: Sat May 30, 2009 10:19 pm
Location: Chennai, India

Post by arcvns » Mon Jun 22, 2009 6:46 pm

nidhi1985 wrote:while doing a jjscan its giving me an error of severity 8
nidhi1985,

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

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