MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Matching two input files as generic and loading output files

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
vinothenator_1782
Beginner


Joined: 19 May 2006
Posts: 14
Topics: 4

PostPosted: Thu Mar 19, 2009 12:42 pm    Post subject: Matching two input files as generic and loading output files Reply with quote

Hi,

I have two input files

INFILE1
INKEY1 2 9 A

INFILE2
INKEY2 1 9 A
Job infile1(inkey1) infile2(inkey2)
OUTFILE FORMAT IS INFILE1(1,12) INFILE2(2,10) INFILE1(22 13) INFILE2(15,6)....
INFILE (1,12) = FROM 1 POSITION TO 12 BYTES

I will match the two input file through keys and want to write into output file for 5 fields ( 2 fields form infile1, 3 fields from outfile2).

For other requirement i will write 6fields in output file. the field position will varies some time from input file1 2 , and inputfile2 from 3.

For other requirement i will write 10fields in output file.

I want to pass through fields size ( from position, length of the field).. any no of fields, and need to write in output file. The fields will varies , some requirement the fields from file1 is 5 , fields from file2 is 6.

I want to pass fields position through parm. generically it can right into output file

Please advise is it possible.
Back to top
View user's profile Send private message
vinothenator_1782
Beginner


Joined: 19 May 2006
Posts: 14
Topics: 4

PostPosted: Thu Mar 19, 2009 11:03 pm    Post subject: Reply with quote

Hi, I didn't get any response. Please advise whether my question is understandble or or not?
Back to top
View user's profile Send private message
Sqlcode
Intermediate


Joined: 15 Dec 2006
Posts: 157
Topics: 38

PostPosted: Fri Mar 20, 2009 9:33 am    Post subject: Reply with quote

vinothenator_1782,

Please show some sample of data and expected output.

Thanks,
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Fri Mar 20, 2009 10:42 am    Post subject: Reply with quote

vinothenator_1782 wrote:
Hi, I didn't get any response. Please advise whether my question is understandble or or not?


Vinothenator_1782,

Reasons for no response

1. You are a syncsort customer
2. You would later ask the moderator to delete the topic
3. You haven't provided enough details (LRECL , RECFM ,Sample data ...)


Just an Fyi , I have a solution for FB files but since you are syncsort customer I would let the syncsort folks help you.
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Brian Wood
Beginner


Joined: 14 Jan 2009
Posts: 37
Topics: 0
Location: USA

PostPosted: Fri Mar 20, 2009 3:10 pm    Post subject: Reply with quote

- Thank you, Mr. Kolusu, for the helpful clarification that vinothenator_1782 is a SyncSort user, as this was not mentioned in his post -

vinothenator_1782: I do not understand enough of your description to provide you with an assessment as to whether what you are trying to accomplish is possible using SyncSort, but I will give it a try.

My understanding of the situation, so far, is as follows:

1) You have 2 input files. Some field in File1 contains a 'key' that will correspond to a similar field in File2 (it is unclear from your description where these 'key' fields are located in the respective input files).

2) You want to write the output from the following fields from File1 and File2 whenever the 'key' matches:

File1:
position 1 for a length of 12
position 22 for a length of 13

File2:
position 2 for a length of 10
position 15 for a length of 6


If this is correct, and (for purposes of this coding example) the field containing the common 'key' is located in each file at (for example) the end of each record immediately following the field(s) you have described, then you could use JOIN processing, as in the following example (assuming fixed-length data):

For the File1 'key' field I am assuming a two-byte field starting in position 35, and I am assuming Ascending order.

For the File2 'key field I am assuming a two-byte field starting in position 21, and I am assuming Ascending order.

Code:
//SYSIN  DD *
  JOINKEYS FILE=F1,FIELDS=(35,2,A)
  JOINKEYS FILE=F2,FIELDS=(21,2,A)
  REFORMAT FIELDS=(F1:1,12,
                   F2:2,10,
                   F1:22,13,
                   F2:15,6)
  SORT FIELDS=COPY
/*


I have specified SORT FIELDS=COPY since I do not know if you have any requirement to SORT the data.

If you are a SyncSort user, I assume that you have access to the SyncSort for z/OS Programmer's Guide and the supplemental 'Exploiting JOIN' documentation, and I assume that you will be familiar with the appropriate JCL needed for such processing.

The above coding example is meant just to illustrate how JOIN processing can be used to combine fields from two input files based upon matching data contained in a common 'key' field. I have not tested the above syntax, but just wanted to provide a quick example. What you would need to do is specifically define the 'key' field(s), and then whatever fields you need to extract from the two input files in order to create the desired output.

Does this help? If you requre further assistance, please provde more detail (LRECL, RECFM, sample data, etc.), and I will try to help you further. I admit that I do not understand your use of the word "generic" in the context of your post. The type of JOIN processing I envision using requires a specific understanding of the positions and lengths of each field you would need to specify.
_________________
Brian Wood
SyncSort Mainframe Product Services
201-930-8260
zos_tech@syncsort.com
Back to top
View user's profile Send private message Send e-mail
kalatur
Beginner


Joined: 09 Apr 2007
Posts: 2
Topics: 0
Location: Bay Area

PostPosted: Fri Mar 20, 2009 7:09 pm    Post subject: Reply with quote

kolusu wrote:
vinothenator_1782 wrote:
Hi, I didn't get any response. Please advise whether my question is understandble or or not?


Vinothenator_1782,

Reasons for no response

1. You are a syncsort customer ...


I understand why YOU didn't respond, since you are an IBM guy. Are you saying that nobody answers syncsort questions here? Sounds a bit odd.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Fri Mar 20, 2009 8:07 pm    Post subject: Reply with quote

kalatur wrote:
I understand why YOU didn't respond, since you are an IBM guy. Are you saying that nobody answers syncsort questions here? Sounds a bit odd.


Kalatur,

I am not sure as to how you interpreted my statement as nobody answering syncsort questions on this board. There are handful of people who answer syncsort questions apart from the syncsort reps on this board. But none of them responded to the question.

1. The question was unanswered for almost 24 hours
2. I do answer most of the questions on this board with exception of questions related to by IBM's Competitive product questions.
3. Last but not least I Own this board and I felt it is my responsibility to give OP a reason as to why his question is left unanswered even though the question is related to a sort product.

Thanks

Kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
vinothenator_1782
Beginner


Joined: 19 May 2006
Posts: 14
Topics: 4

PostPosted: Fri Mar 20, 2009 11:59 pm    Post subject: Reply with quote

hi,
I know i can do it SYNC SORT. Please below data and let me know.

INFILE1 KEY ( 2,9) , LRECL=600, RECFM=FB
INFILE2 KEY (1,9) , LRECL=120, RECFM= FB

OUTFILE = (F1:1,2,9,15,F2:2,9......) - My output format will varies depending on my requirement.

Below details i will give in my input file , and then it's has to generate SYNCSORT CONTROL CARD, AND JCL.

In my input file contains below data. for one request.

INFILE1 600
INFILE2 120
OUTFILE 600
(1,9,A)
(2,9,A)
F1,FIELDS=(1,9,A)
F2,FIELDS=(2,9,A)
(F1:1,12,F2:2,10,F1:22,13,F2:15,6)


For another request
INFILE1 200
INFILE2 500
OUTFILE 150
(35,2,A)
(21,2,A)
F1,FIELDS=(35,2,A)
F2,FIELDS=(21,2,A)
(F1:1,12,F2:2,10,F1:22,13,F2:15,6,F1:200,5,F2:20,2)

I will give only above these details. It should create JCL and has to submite. Please advise is there any tool to generate.

Kolosu , I want to generate as utility , i know we cand do it SYNCSORT or EASTRIEVE PROGRAM as manully. But i will give my details as above mentioned to dynamically, then it should generate JCL.

For above question if moderator having coding, please send me.

Previously do to some reason i asked delete my question in moderator. if moderator feels bad , i am sorry.


Thanks&Regards.
Back to top
View user's profile Send private message
Brian Wood
Beginner


Joined: 14 Jan 2009
Posts: 37
Topics: 0
Location: USA

PostPosted: Mon Mar 23, 2009 3:38 pm    Post subject: Reply with quote

vinothenator:
I first ran a step that created the template for my basic control statements. Note the reference to INKEY1, INKEY2 and OUTFILE (I simply used the names you had mentioned):

Code:
//STEP01 EXEC PGM=SORT
//SORTOUT  DD DSN=WWCBRW.SR526677.JOINCARD,
//            UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(NEW,CATLG),
//            DCB=(RECFM=FB,LRECL=80,BLKSIZE=0)
//SYSOUT DD SYSOUT=*
//SYSIN  DD *
  SORT FIELDS=COPY
//SORTIN DD *
  SORT FIELDS=COPY
  JOINKEYS FILE=F1,FIELDS=INKEY1
  JOINKEYS FILE=F2,FIELDS=INKEY2
  REFORMAT FIELDS=OUTFILE


I then created a second step that passed control statements in a $ORTPARM DD that would override INKEY1, INKEY2 and OUTFILE with your desired values:

Code:
//STEP02 EXEC PGM=SORT
//SORTOUT  DD DSN=my.cntlstmt.file1,
//            UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(NEW,CATLG),
//            DCB=(RECFM=FB,LRECL=80,BLKSIZE=0)
//SYSOUT DD SYSOUT=*
//SYSIN  DD DUMMY
//$ORTPARM DD *
  SORT FIELDS=COPY
  OUTREC IFTHEN=(WHEN=INIT,BUILD=(1,80)),
  IFTHEN=(WHEN=(27,6,CH,EQ,C'INKEY1'),
          OVERLAY=(27:C'(2,9,A)'),
          HIT=NEXT),
  IFTHEN=(WHEN=(27,6,CH,EQ,C'INKEY2'),
          OVERLAY=(27:C'(1,9,A)'),
          HIT=NEXT),
  IFTHEN=(WHEN=(19,7,CH,EQ,C'OUTFILE'),
          OVERLAY=(19:C'(F1:1,12,F2:2,10,F1:22,13,F2:15,6)'))
//SORTIN   DD DSN=WWCBRW.SR526677.JOINCARD,DISP=SHR


Using this process you would need to 1) change the name of the output file that would contain the new control statements, and 2) modify the contents of the $ORTPARM DD to reflect the desired values for INKEY1, INKEY2 and OUTFILE.

You would then need to run a third SORT step using the new control statements as the SYSIN DD.

This is simply an example on how to use SyncSort to build control statements. Perhaps this will be of some help to you.
_________________
Brian Wood
SyncSort Mainframe Product Services
201-930-8260
zos_tech@syncsort.com
Back to top
View user's profile Send private message Send e-mail
vinothenator_1782
Beginner


Joined: 19 May 2006
Posts: 14
Topics: 4

PostPosted: Tue Mar 24, 2009 10:51 am    Post subject: Reply with quote

Can we pass multiple keys for INFILE1 & INFIEL2 and we can do sortout. Please advise with coding
Back to top
View user's profile Send private message
Brian Wood
Beginner


Joined: 14 Jan 2009
Posts: 37
Topics: 0
Location: USA

PostPosted: Tue Mar 24, 2009 5:04 pm    Post subject: Reply with quote

vinothenator:
By "pass multiple keys for INFILE1 & INFILE2", do you mean can JOIN processing have multiple key fields? The answer to that is yes. JOIN would require that there be common key field(s) that exist in both files, although they could be at different positions. The common key field can have multiple keys. Example: File1 could have what you refer to as "INKEY1" at position 2 for a length of 9, ascending, and another key at position 50 for a length of 2, descending. "INKEY2" could potentially be at 1 for a length of 9, ascending, and position 201 for a length of 2.
You can use the method I described to provide overrides for whatever values you want to use for the JOINKEYS statements or for the REFORMAT statement, since this is what was designed into the original "template".

Please understand, however, that the coding example I have provided is limited to bulding the control statements for your SYSIN. Have you thought about designing a PROC using symbolics to provide the values you want for your JCL (such as the SORTOUT RECFM)?
_________________
Brian Wood
SyncSort Mainframe Product Services
201-930-8260
zos_tech@syncsort.com
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group