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 temp, different LRECL files and use same file for I&am

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


Joined: 05 Sep 2003
Posts: 483
Topics: 48

PostPosted: Wed Dec 12, 2007 2:05 am    Post subject: Merge temp, different LRECL files and use same file for I&am Reply with quote

Hi,

I have two temp files created from a SORT step (&&FILE1 and &&FILE1). The LRECL of these two files is 131.
I have one more file with FB format and LRECL as 304. Say this as INPUT file.
Now, I wanna merge these three files (&&FILE1, &&FILE1 and INPUT) into a single output file. The thing is I wanna use the INPUT file as the output file.
Code:
//STEP02   EXEC PGM=ICETOOL                             
//TOOLMSG  DD SYSOUT=*                                 
//DFSMSG   DD SYSOUT=*                                 
//IN1      DD DSN=&&FILE1                               
//IN2      DD DSN=&&FILE2                               
//IN3      DD DSN=RIVOT010.CPS.SGP.IDDTEMPA,DISP=SHR
//OUT      DD DSN=RIVOT010.CPS.SGP.IDDTEMPA,DISP=SHR
//TOOLIN   DD *                                         
  COPY FROM(IN1) TO(OUT) USING(CTL1)                   
  COPY FROM(IN2) TO(OUT) USING(CTL2)                   
  COPY FROM(IN3) TO(OUT)                               
//CTL1CNTL DD *                                         
  OUTREC FIELDS=(1,131,                                 
                 304:X)                                 
//CTL2CNTL DD *                                         
  OUTREC FIELDS=(1,131,                                 
                 304:X)                                 
/*                                                     
//*                                                     


I did make use of the above job by padding the extra characters to spaces to acheieve what I want. But left with errors.
Back to top
View user's profile Send private message Send e-mail
vivek1983
Intermediate


Joined: 20 Apr 2006
Posts: 222
Topics: 24

PostPosted: Wed Dec 12, 2007 3:57 am    Post subject: Reply with quote

Hi,

How about using another temp dataset to concatenate all the input datasets and then copy this temp dataset to the desired output dataset? I guess you can do that in 2 steps. I have not tested anything given below as I am at home now.

Code:


//STEP02   EXEC PGM=ICETOOL                             
//TOOLMSG  DD SYSOUT=*                                 
//DFSMSG   DD SYSOUT=*                                 
//IN1      DD DSN=&&FILE1                               
//IN2      DD DSN=&&FILE2     
//IN3      DD DSN=RIVOT010.CPS.SGP.IDDTEMPA,DISP=SHR 
//IN4      DD DSN=DSN=&FILE4,SPACE=(CYL,(5,5),RLSE),DISP=(MOD,PASS)                         
//TOOLIN   DD *                                         
  COPY FROM(IN1) TO(IN4) USING(CTL1)                   
  COPY FROM(IN2) TO(IN4) USING(CTL1)                   
  COPY FROM(IN3) TO(IN4)                               
//CTL1CNTL DD *                                         
  OUTREC FIELDS=(1,131,                                 
                 304:X)                                                           
/*                                                     
//*   

//STEP03   EXEC PGM=ICETOOL                             
//TOOLMSG  DD SYSOUT=*                                 
//DFSMSG   DD SYSOUT=*                                 
//IN4      DD DSN=&&FILE1,DISP=SHR   
//OUT     DD DSN=RIVOT010.CPS.SGP.IDDTEMPA,DISP=(OLD,CATLG,CATLG)
//TOOLIN   DD *                                         
  COPY FROM(IN4) TO(OUT)
/*                                                     
//*   


_________________
Vivek G
--------------------------------------
A dream is just a dream. A goal is a dream with a plan and a deadline. (Harvey Mackay)
Back to top
View user's profile Send private message
vkphani
Intermediate


Joined: 05 Sep 2003
Posts: 483
Topics: 48

PostPosted: Wed Dec 12, 2007 4:15 am    Post subject: Reply with quote

Vivek,

For both the steps I am getting the error as INVALID DATA SET ATTRIBUTES SPECIFIED.
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


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

PostPosted: Wed Dec 12, 2007 11:14 am    Post subject: Reply with quote

vkphani,

Concatenate both temp files to a single DD and copy that to a temp file of 304 length. Now use DISP=mod and copy the contents of your input file to temp file and in the next pass copy the temp file back to Input file.

Here is the JCL

Code:

//STEP0100 EXEC PGM=ICETOOL                                 
//TOOLMSG  DD SYSOUT=*                                       
//DFSMSG   DD SYSOUT=*
//IN1      DD DSN=&&FILE1,DISP=SHR                               
//         DD DSN=&&FILE2,DISP=SHR                                       
//IN2      DD DSN=YOUR INPUT FILE,                             
//            DISP=OLD                                       
//T1       DD DSN=&&T1,DISP=(MOD,PASS),SPACE=(CYL,(1,1),RLSE)
//TOOLIN   DD *                                             
  COPY FROM(IN1) TO(T1) USING(CTL1)                         
  COPY FROM(IN2) TO(T1)                                     
  COPY FROM(T1) TO(IN2)                                     
//CTL1CNTL DD *                                             
  OUTREC FIELDS=(01,131,304:X)                               
//*                                                         


Hope this helps...

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


Joined: 05 Sep 2003
Posts: 483
Topics: 48

PostPosted: Thu Dec 13, 2007 12:44 am    Post subject: Reply with quote

Kolusu,
Thanks for your reply. But I got the below error.
Code:
ICE027A 3 END OF          FIELD BEYOND MAXIMUM RECORD LENGTH

My full JCL is as below. STEP01 is executed successfully but STEP02 ended with error.
Code:
//STEP01   EXEC PGM=SORT                                       
//SYSOUT   DD SYSOUT=*                                         
//SORTDIAG DD DUMMY                                             
//SORTIN   DD DSN=RIVOT010.CPS.SGP.IDDEREC,DISP=SHR             
//FILE1    DD DSN=&&FILE1,SPACE=(CYL,(5,5),RLSE),DISP=(MOD,PASS)
//FILE2    DD DSN=&&FILE2,SPACE=(CYL,(5,5),RLSE),DISP=(MOD,PASS)
//SYSIN    DD *                                                 
  SORT FIELDS=COPY                                             
  OUTFIL FNAMES=FILE1,INCLUDE=(1,2,CH,EQ,C'1D'),               
  BUILD=(5,3,11,12,29,6,35,3,38,3,59,1,63,2,68,1,78,3,C'    ', 
        14,4,18,3,58,1,11,6,24,15,5,15,24,15,24,15,24,15)       
  OUTFIL FNAMES=FILE2,INCLUDE=(1,2,CH,EQ,C'1H'),               
  BUILD=(5,3,11,12,29,6,35,3,38,3,59,1,63,2,68,1,78,3,C'    ', 
        16,4,20,3,58,1,11,6,24,15,5,15,24,15,24,15,24,15)       
/*                                                             
//*                                                             
//STEP02   EXEC PGM=ICETOOL                                     
//TOOLMSG  DD SYSOUT=*                                         
//DFSMSG   DD SYSOUT=*                                         
//IN1      DD DSN=&&FILE1,DISP=SHR                             
//         DD DSN=&&FILE2,DISP=SHR                             
//IN2      DD DSN=RIVOT010.CPS.SGP.IDDTEMPA.NEW,DISP=OLD       
//T1       DD DSN=&&T1,DISP=(MOD,PASS),SPACE=(CYL,(1,1),RLSE)   
//TOOLIN   DD *                                                 
  COPY FROM(IN1) TO(T1) USING(CTL1)                             
  COPY FROM(IN2) TO(T1)                                         
  COPY FROM(T1) TO(IN2)                                         
//CTL1CNTL DD *             
  OUTREC FIELDS=(1,131,304:X)
/*                           
//*                                                     
Back to top
View user's profile Send private message Send e-mail
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Thu Dec 13, 2007 11:15 am    Post subject: Reply with quote

You said in your original post that FILE1 and FILE2 have LRECL=131. But the job you show above creates FILE1 and FILE2 with LRECL=127. That's why you got the ICE027A message. You either need to create the FILEs with LRECL=131 or change the CTL1CNTL OUTREC statement to use 127 instead of 131.

BTW, you don't actually need that extra SORT step unless you need &&FILE1 and &&FILE2 as separate files for some reason. If not, you can use an INCLUDE statement and IFTHEN clauses in CTL1CNTL to reformat the RIVOT010.CPS.SGP.IDDEREC records directly to T1.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
kolusu
Site Admin
Site Admin


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

PostPosted: Thu Dec 13, 2007 11:19 am    Post subject: Reply with quote

vkphani,

In your first post you said

vkphani wrote:
I have two temp files created from a SORT step (&&FILE1 and &&FILE1). The LRECL of these two files is 131.


Now in your first step you are creating the temp files with only 127 as the LRECL. The second step would obviously fail with ICE027A because it is expecting a 131 byte file.

If you are just creating 127 bytes then change the CTL1CNTL to the following
Code:

//CTL1CNTL DD *             
  OUTREC FIELDS=(1,127,304:X)


btw your Job can be simplified using IFTHEN and avoid another pass.

Here is a 1 step DFSORT/ICETOOL which will do that
Code:

//STEP0100 EXEC PGM=ICETOOL                                       
//TOOLMSG  DD SYSOUT=*                                             
//DFSMSG   DD SYSOUT=*   
//IN1      DD DSN=RIVOT010.CPS.SGP.IDDEREC,DISP=SHR
//IN2      DD DSN=RIVOT010.CPS.SGP.IDDTEMPA.NEW,DISP=OLD
//T1       DD DSN=&&T1,DISP=(MOD,PASS),SPACE=(CYL,(10,10),RLSE)     
//TOOLIN   DD *                                                   
  COPY FROM(IN1) USING(CTL1)                                       
  COPY FROM(IN2) TO(T1)                                           
  COPY FROM(T1) TO(IN2)                                           
//CTL1CNTL DD *                                                   
  INCLUDE COND=(1,2,SS,EQ,C'1H,1D')                               
  OUTFIL FNAMES=T1,   
         IFTHEN=(WHEN=(1,2,CH,EQ,C'1D'),             
         BUILD=(5,3,11,12,29,6,35,3,38,3,59,1,63,2,68,1,78,3,C'    ',
                14,4,18,3,58,1,11,6,24,15,5,15,24,15,24,15,24,15,304:X)),
         IFTHEN=(WHEN=(1,2,CH,EQ,C'1H'),         
          BUILD=(5,3,11,12,29,6,35,3,38,3,59,1,63,2,68,1,78,3,C'    ',
                 16,4,20,3,58,1,11,6,24,15,5,15,24,15,24,15,24,15,304:X))
/*


Hope this helps...

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


Joined: 05 Sep 2003
Posts: 483
Topics: 48

PostPosted: Thu Dec 13, 2007 11:33 pm    Post subject: Reply with quote

Kolusu,

Excellent. Thanks a lot for your reply.
Back to top
View user's profile Send private message Send e-mail
Terry_Heinze
Supermod


Joined: 31 May 2004
Posts: 391
Topics: 4
Location: Richfield, MN, USA

PostPosted: Fri Dec 14, 2007 11:20 pm    Post subject: Reply with quote

Do you have a compelling reason to overlay your original input with your output? This is generally considered not a good idea unless you've backed up your original input.
_________________
....Terry
Back to top
View user's profile Send private message Send e-mail
vkphani
Intermediate


Joined: 05 Sep 2003
Posts: 483
Topics: 48

PostPosted: Mon Dec 17, 2007 2:28 am    Post subject: Reply with quote

Terry,

I don't wanna create an extra step and so I am overlaying my original input. Anyway we do have backup of the input file.
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