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 

Merge input files and limit number of records selected

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


Joined: 02 Dec 2002
Posts: 629
Topics: 176
Location: Stockholm, Sweden

PostPosted: Wed Aug 20, 2014 7:32 am    Post subject: Merge input files and limit number of records selected Reply with quote

I know this must be trivial, but despite the 10's of googled sites I've read, I can't find a relevant example.

All I want to do is use DFSORT/ICETOOL to merge 4 files but only select the first 100 records from each file. Here's AN example of the code I've tried (without the 100 record limitation so far)
Code:

//S1       DD DSN=MYRA.FT.MYRA.Q485301.G0020V00,DISP=SHR       
//S2       DD DSN=MYRA.FT.MYRA.Q485301.D1303,DISP=SHR         
//S3       DD DSN=MYRA.FT.MYRA.Q485301.G0026V00,DISP=SHR       
//S4       DD DSN=MYRA.FT.MYRA.Q485301.SEKTOR3,DISP=SHR       
//*                                                           
//OUT      DD DSN=MISI01.MYRA.Q485301.SMALLISH,DISP=(,CATLG), 
//         RECFM=VB,LRECL=423,SPACE=(TRK,(5,5))               
//*                                                           
//TOOLIN   DD *                                               
 COPY FROM(S1) TO(OUT) USING(CTL1)                             
 COPY FROM(S2) TO(OUT) USING(CTL1)                             
 COPY FROM(S3) TO(OUT) USING(CTL1)                             
 COPY FROM(S4) TO(OUT) USING(CTL1)                             
//CTL1CNTL DD *                                               
 OPTION COPY                                                   
 OUTFIL FNAMES=OUT                                             
/*                                                             


I've seen example of splitting one file into multiple output files, I've seen examples where multiple input files are spliced into one output file etc etc, but nothing as trivial (?) as what I want to do
_________________
Michael
Back to top
View user's profile Send private message Send e-mail
William Collins
Supermod


Joined: 03 Jun 2012
Posts: 437
Topics: 0

PostPosted: Wed Aug 20, 2014 12:42 pm    Post subject: Reply with quote

Do you mean MERGE as in MERGE (input files in key order, output file in key order from each) or do you want a "concatenation", 100 records from file 1, then 100 from file 2, then file 3, then file 4?
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Wed Aug 20, 2014 1:10 pm    Post subject: Reply with quote

misi01,

Use the following JCL. pay attention to the DISP parameter for the OUT file.

Code:

//STEP0100 EXEC PGM=ICETOOL             
//TOOLMSG  DD SYSOUT=*                   
//DFSMSG   DD SYSOUT=*                   
//IN1      DD DISP=SHR,DSN=MYRA.FT.MYRA.Q485301.G0020V00       
//IN2      DD DISP=SHR,DSN=MYRA.FT.MYRA.Q485301.D1303       
//IN3      DD DISP=SHR,DSN=MYRA.FT.MYRA.Q485301.G0026V00
//IN4      DD DISP=SHR,DSN=MYRA.FT.MYRA.Q485301.SEKTOR3
//OUT      DD DSN=MISI01.MYRA.Q485301.SMALLISH,DISP=(MOD,CATLG),
//            SPACE=(TRK,(5,5))               
//*         
//TOOLIN   DD *                         
  COPY FROM(IN1) TO(OUT) USING(CTL1)     
  COPY FROM(IN2) TO(OUT) USING(CTL1)     
  COPY FROM(IN3) TO(OUT) USING(CTL1)     
  COPY FROM(IN4) TO(OUT) USING(CTL1)     
//CTL1CNTL DD *                         
  OPTION STOPAFT=100                     
//*

_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
misi01
Advanced


Joined: 02 Dec 2002
Posts: 629
Topics: 176
Location: Stockholm, Sweden

PostPosted: Thu Aug 21, 2014 12:16 am    Post subject: As usual, thanks. Reply with quote

I changed to what you suggested above and it still failed with RC 16.

Then I copied/pasted your code above and submitted it - success. Then I tried removing a bit at a time where my original code differed from yours until .....

The RC 16 was coming from the fact that I'd defined the RECFM/LRECL. Once I removed them, the job worked.

No wonder I was having problems.
_________________
Michael
Back to top
View user's profile Send private message Send e-mail
William Collins
Supermod


Joined: 03 Jun 2012
Posts: 437
Topics: 0

PostPosted: Thu Aug 21, 2014 8:36 am    Post subject: Reply with quote

If it was giving you non-zero RC and an error message, the details would have been nice.

I think the two important things were the STOPAFT, which you'd perhaps abandoned on the example you posted, and the MOD for the DISP.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Thu Aug 21, 2014 10:17 am    Post subject: Re: As usual, thanks. Reply with quote

misi01 wrote:
I changed to what you suggested above and it still failed with RC 16.


misi01,

DFSORT does a good job of listing what the error is with message Suffix A ie. ICE217A The informational messages have a suffix of I

misi01 wrote:

Then I copied/pasted your code above and submitted it - success. Then I tried removing a bit at a time where my original code differed from yours until .....

The RC 16 was coming from the fact that I'd defined the RECFM/LRECL. Once I removed them, the job worked.

No wonder I was having problems.


I would suggest you look up the message in DFSORT Messages, Codes and Diagnosis Guide and you would have resolved it on the first try itself.

So what was the error message?
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
misi01
Advanced


Joined: 02 Dec 2002
Posts: 629
Topics: 176
Location: Stockholm, Sweden

PostPosted: Wed Sep 03, 2014 1:58 am    Post subject: Sorry to have taken so long Reply with quote

Been ill etc etc.

I reran the JCL above and received the following (in TOOLMSG)
Quote:

ICE632I 0 SOURCE FOR ICETOOL STATEMENTS: TOOLIN


ICE630I 0 MODE IN EFFECT: STOP

COPY FROM(IN1) TO(OUT) USING(CTL1)
ICE606I 0 DFSORT CALL 0001 FOR COPY FROM IN1 TO OUT USING CTL1CNTL TERMINATED
ICE602I 0 OPERATION RETURN CODE: 16

ICE630I 2 MODE IN EFFECT: SCAN

COPY FROM(IN2) TO(OUT) USING(CTL1)
ICE612I 0 NO ERRORS FOUND IN STATEMENT

COPY FROM(IN3) TO(OUT) USING(CTL1)
ICE612I 0 NO ERRORS FOUND IN STATEMENT

COPY FROM(IN4) TO(OUT) USING(CTL1)
ICE612I 0 NO ERRORS FOUND IN STATEMENT


ICE601I 0 DFSORT ICETOOL UTILITY RUN ENDED - RETURN CODE: 16


In DFSMSG I got
Quote:

ICE200I 0 IDENTIFIER FROM CALLING PROGRAM IS 0001
ICE805I 0 JOBNAME: Q48SORT9 , STEPNAME: STEP0100
ICE802I 0 BLOCKSET TECHNIQUE IN CONTROL
ICE143I 0 BLOCKSET COPY TECHNIQUE SELECTED
ICE250I 0 VISIT http://www.ibm.com/storage/dfsort FOR DFSORT PAPERS, EXAMPLES AN
ICE000I 0 - CONTROL STATEMENTS FOR 5650-ZOS, Z/OS DFSORT V2R1 - 08:52 ON WED SE
OPTION STOPAFT=100
ICE146I 0 END OF STATEMENTS FROM CTL1CNTL - PARAMETER LIST STATEMENTS FOLLOW
DEBUG NOABEND,ESTAE
OPTION MSGDDN=DFSMSG,LIST,MSGPRT=ALL,RESINV=0,SORTDD=CTL1,SORTIN=IN1,S
RTOUT=OUT,DYNALLOC
SORT FIELDS=COPY
ICE043A 3 INVALID DATA SET ATTRIBUTES: OUT RECFM - REASON CODE IS 08
ICE751I 0 C5-I12417 C6-BASE C7-K96411 C8-I15445 E7-I12417
ICE052I 3 END OF DFSORT


I'm guessing the "INVALID DATA SET ATTRIBUTES" message is the indicator, but as a newbie to DFSORT, it's not really telling me much.
_________________
Michael
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


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

PostPosted: Wed Sep 03, 2014 3:06 am    Post subject: Reply with quote

misi01,

1. click on quick manuals link at top of this page
2. scroll down to DFSORT manuals and click on DFSORT Messages, codes and diagnosis guide
3. click on torch light icon at top and search for ICE043A
4. read about the reason code 8 and if you still feel DFSORT isn't telling much then please let us know
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
misi01
Advanced


Joined: 02 Dec 2002
Posts: 629
Topics: 176
Location: Stockholm, Sweden

PostPosted: Wed Sep 03, 2014 5:15 am    Post subject: Thanks Reply with quote

Döööööh (aimed at me).

It would have helped if I'd REALLY checked that the input files were VB rather than the FB they, in fact, were.

Once I changed the output DCB to FB (not forgetting the DISP parm), everything worked fine.

Thanks for your patience.
_________________
Michael
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