IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Appending fields to Matched Recs from Varying Length Files


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
nikyojin

New User


Joined: 05 Oct 2005
Posts: 94

PostPosted: Fri May 19, 2006 7:02 pm
Reply with quote

Hi,
Code:
//SORT1   EXEC PGM=ICETOOL                                           
//SYSOUT  DD SYSOUT=*                                                 
//TOOLMSG DD SYSOUT=*                                                 
//LIST99  DD SYSOUT=*                                                 
//DFSMSG  DD SYSOUT=*                                                 
//IN1     DD DSN=TESTIBN.IBTRACK.NIK2,DISP=SHR                       
//IN2     DD DSN=TESTIBN.PROFACCT.NIK1,DISP=SHR                       
//T1      DD DSN=&&T1,UNIT=SYSDA,SPACE=(TRK,(10,20)),DISP=(MOD,PASS) 
//OUT     DD DSN=TESTIBN.IBTRACK.DSPLYID.FILE,                       
//           DISP=(NEW,CATLG,DELETE),                                 
//           SPACE=(TRK,(10,20)),                                     
//           UNIT=SYSDA,                                             
//           LRECL=211                                               
//TOOLIN  DD *                                                       
  SELECT FROM(IN1)   TO(T1)  ON(2,5,PD) ON(7,2,PD) FIRST USING(CTL1) 
  SELECT FROM(IN2)   TO(T1)  ON(1,5,PD) ON(6,2,PD) FIRST USING(CTL2) 
  SPLICE FROM(T1)    TO(OUT) ON(2,5,PD) ON(7,2,PD) WITHEACH-         
         WITH(201,16) USING(CTL3)                                     
/*                                                                   
//CTL1CNTL DD *                                                       
  OUTFIL FNAMES=T1                                                   
/*                                                                   
//CTL2CNTL DD *                                                       
  OUTFIL FNAMES=T1,OVERLAY=(196:425,16)                               
/*                                                                   
//CTL3CNTL DD *                                                       
  OUTFIL FNAMES=OUT,OUTREC=(1,211)                                   
/*                                                         



The above JCl is being used by me to append a field value from the second file to the first file based on matching recs.
The error being displayed is for CTL2
Quote:
SORT FIELDS=(1,5,PD,A,6,2,PD,A)
MODS E35=(ICE35DU,12288)
ICE201I 0 RECORD TYPE IS F - DATA STARTS IN POSITION 1
ICE222A 0 450 BYTE FIXED RECORD LENGTH IS NOT EQUAL TO 195 BYTE LRECL FOR T1


The first file length is 195 and the other file length is 450.....

Pls inform me the problem in the JCL
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri May 19, 2006 8:20 pm
Reply with quote

Quote:
The first file length is 195 and the other file length is 450.....


Code:

SELECT FROM(IN1)   TO(T1)  ON(2,5,PD) ON(7,2,PD) FIRST USING(CTL1)


creates T1 with LRECL=195.

Code:

SELECT FROM(IN2)   TO(T1)  ON(1,5,PD) ON(6,2,PD) FIRST USING(CTL2)
//CTL2CNTL DD *
  OUTFIL FNAMES=T1,OVERLAY=(196:425,16)       


This erroneously tries to MOD 450-byte records at the end of T1 which was previously created with LRECL=195. You can't do that. With MOD, all of the records must be the same length.

Of course, I don't know exactly what you're trying to do so I'd only be guessing at how to fix it, but creating T1 with LRECL=450 would allow the 450-byte records to be MODed on to T1:

Code:

SELECT FROM(IN1)   TO(T1)  ON(2,5,PD) ON(7,2,PD) FIRST USING(CTL1)
//CTL1CNTL DD *
   OUTFIL FNAMES=T1,BUILD=(450:X)
Back to top
View user's profile Send private message
nikyojin

New User


Joined: 05 Oct 2005
Posts: 94

PostPosted: Fri May 19, 2006 9:14 pm
Reply with quote

Thanks Frank for the quick reply....I have achieved my objective of appending the required field to the first file which was of length 195. The new file created is of length 211.
Jcl Used :-
Code:

//SORT1   EXEC PGM=ICETOOL                                       
//SYSOUT  DD SYSOUT=*                                             
//TOOLMSG DD SYSOUT=*                                             
//LIST99  DD SYSOUT=*                                             
//DFSMSG  DD SYSOUT=*                                             
//IN1     DD DSN=TESTIBN.IBTRACK.NIK2,DISP=SHR                   
//IN2     DD DSN=TESTIBN.PROFACCT.NIK1,DISP=SHR                   
//T1      DD DSN=&&T1,UNIT=SYSDA,SPACE=(TRK,(10,20)),DISP=(,PASS)
//T2      DD DSN=&&T2,UNIT=SYSDA,SPACE=(TRK,(10,20)),DISP=(,PASS)
//CONCAT  DD DSN=*.T1,VOL=REF=*.T1,DISP=(OLD,PASS)               
//        DD DSN=*.T2,VOL=REF=*.T2,DISP=(OLD,PASS)               
//OUT     DD DSN=TESTIBN.IBTRACK.DSPLYID.FILE,                   
//           DISP=(NEW,CATLG,DELETE),                             
//           SPACE=(TRK,(10,20)),                                 
//           UNIT=SYSDA,                                         
//           LRECL=211                                           
//TOOLIN  DD *                                                   
  COPY   FROM(IN1)   TO(T1) USING(CTL1)                           
  COPY   FROM(IN2)   TO(T2) USING(CTL2)                           
  SPLICE FROM(CONCAT) TO(OUT) ON(2,5,PD) ON(7,2,PD) WITHEACH-     
         WITH(196,16)                                             
/*                                                               
//CTL1CNTL DD *                                                   
  OUTREC FIELDS=(1,195,211:X)                                     
/*                                                               
//CTL2CNTL DD *                                                   
  OUTREC FIELDS=(2:1,7,196:425,16)                               
/*                                                               


I'll be trying to solve the same thing using the previous JCl....I needed this real urgent....Thanks for ur reply.....
Back to top
View user's profile Send private message
nikyojin

New User


Joined: 05 Oct 2005
Posts: 94

PostPosted: Sat May 20, 2006 12:52 am
Reply with quote

Hi Frank,
Requirement :-
IN1 :- PS File having LRECL = 195 ; keys(2,5 and 7,2)
IN2 :- PS File having LRECL = 450 ; keys(1,5 and 6,2)
The o/p resultant file should contain all the fields of IN1 and one field from IN2 after the records are matched.
JCL Used :-

Code:
 
//SORT2   EXEC PGM=ICETOOL                                         
//SYSOUT  DD SYSOUT=*                                               
//TOOLMSG DD SYSOUT=*                                               
//LIST99  DD SYSOUT=*                                               
//DFSMSG  DD SYSOUT=*                                               
//IN1     DD DSN=TESTIBN.IBTRACK.NIK2,DISP=SHR                     
//IN2     DD DSN=TESTIBN.PROFACCT.NIK1,DISP=SHR                     
//T1      DD DSN=&&T1,UNIT=SYSDA,SPACE=(TRK,(10,20)),DISP=(,PASS)   
//OUT     DD DSN=TESTIBN.IBTRACK.DSPLYID.FILE,                     
//           DISP=(NEW,CATLG,DELETE),                               
//           SPACE=(TRK,(10,20)),                                   
//           UNIT=SYSDA,                                           
//           LRECL=211                                             
//TOOLIN  DD *                                                     
  SELECT FROM(IN1)   TO(T1)  ON(2,5,PD) ON(7,2,PD) FIRST USING(CTL1)
  SELECT FROM(IN2)   TO(T1)  ON(1,5,PD) ON(6,2,PD) FIRST USING(CTL2)
  SPLICE FROM(T1)    TO(OUT) ON(2,5,PD) ON(7,2,PD) WITHEACH-       
         WITH(196,16)                                               
/*                                                                 
//CTL1CNTL DD *                                                     
  OUTREC FIELDS=(1,195,450:X)                                       
/*                                                                 
//CTL2CNTL DD *                                                     
  OUTREC FIELDS=(2:1,5,7:6,2,196:425,16)                           
/*                                                                 
//CTL3CNTL DD *                                                     
  OUTREC FIELDS=(1:1,211)                                           
/*                                                                 


The job is running but I'm getting no O/p....Pls infom me where the JCL goes wrong ...2 Recs are to be present in the o/p file....Thanks in advance
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Sat May 20, 2006 4:55 am
Reply with quote

You have several problems including not using MOD for T1, using OUTREC instead of OUTFIL for CTL1CNTL and CTL2CNTL (you must use OUTFIL with SELECT or SPLICE, not OUTREC) and setting the T1 length to 450 for the first file and then to 211 for the second file. Actually, I don't see how the job you show would have run without giving you an error message.

If I understand correctly what you want, this DFSORT/ICETOOL job should do it:

Code:

//SORT2   EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN1     DD DSN=TESTIBN.IBTRACK.NIK2,DISP=SHR
//IN2     DD DSN=TESTIBN.PROFACCT.NIK1,DISP=SHR
//T1      DD DSN=&&T1,UNIT=SYSDA,SPACE=(TRK,(10,20)),DISP=(MOD,PASS)
//OUT     DD DSN=TESTIBN.IBTRACK.DSPLYID.FILE,
//           DISP=(NEW,CATLG,DELETE),
//           SPACE=(TRK,(10,20)),
//           UNIT=SYSDA
//TOOLIN  DD *
SELECT FROM(IN1) TO(T1)  ON(2,5,PD) ON(7,2,PD) FIRST USING(CTL1)
SELECT FROM(IN2) TO(T1)  ON(1,5,PD) ON(6,2,PD) FIRST USING(CTL2)
SPLICE FROM(T1)  TO(OUT) ON(2,5,PD) ON(7,2,PD) WITH(196,16)
/*
//CTL1CNTL DD *
   OUTFIL FNAMES=T1,OUTREC=(1,195,211:X)
/*
//CTL2CNTL DD *
   OUTFIL FNAMES=T1,OUTREC=(2:1,5,7:6,2,196:425,16)
/*
Back to top
View user's profile Send private message
nikyojin

New User


Joined: 05 Oct 2005
Posts: 94

PostPosted: Mon May 22, 2006 2:07 pm
Reply with quote

thanks frank....the problem is solved....
I still have some doubts.
Isn't Outfil used in the control card if there are multiple output files???
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Mon May 22, 2006 8:26 pm
Reply with quote

OUTFIL can be used for one output file or for many output files. OUTFIL has many functions such as reporting, sampling, repeating, converting FB to VB or VB to FB, etc that you might want to use with only one output file, or with many output files. For SELECT and SPLICE, you can use an INREC statement and OUTFIL statements, but you can't use an OUTREC statement (it's just a matter of the way these operators are processed).
Back to top
View user's profile Send private message
nikyojin

New User


Joined: 05 Oct 2005
Posts: 94

PostPosted: Tue May 23, 2006 2:03 am
Reply with quote

Thanks Frank...I'm going thru the Icetool document for more.....
Back to top
View user's profile Send private message
drajagopal

New User


Joined: 20 Jun 2006
Posts: 9

PostPosted: Wed Jan 24, 2007 3:05 pm
Reply with quote

Hi Frank,
I have a similar problem.

I am trying to compare the record count in 2 files.

Code:

//STEP0001 EXEC PGM=ICETOOL                                           
//TOOLMSG  DD SYSOUT=*                                                 
//DFSMSG   DD SYSOUT=*                                                 
//INFILE1  DD DSN=INFILE1,DISP=SHR                     
//INFILE2  DD DSN=INFILE2,DISP=SHR                   
//OUTCNT1  DD DSN=&&OUTCNT1,                                   
//            DISP=(MOD,CATLG,DELETE),                                 
//            UNIT=SYSDA,                                             
//            SPACE=(TRK,(1,0,0),RLSE),                               
//            DCB=(DSORG=PS,RECFM=FB)                                 
//OUTCNT2  DD DSN=&&OUTCNT2,                                   
//            DISP=(NEW,CATLG,DELETE),                                 
//            UNIT=SYSDA,                                             
//            SPACE=(TRK,(1,0,0),RLSE),                               
//            DCB=(DSORG=PS,RECFM=FB)                                 
//TOOLIN DD *                                             
   COPY FROM(INFILE) TO(OUTCNT1) USING(NFC5)               
   COPY FROM(OUTFILE) TO(OUTCNT1) USING(NFC5)             
   SELECT FROM(OUTCNT1) TO(OUTCNT2) ON(1,15,ZD) NODUPS     
   COUNT FROM(OUTCNT2) NOTEMPTY                           
/*                                                         
//NFC5CNTL DD *                                           
   OUTFIL FNAMES=OUTCNT1,                                 
   REMOVECC,                                               
   NODETAIL,                                               
   TRAILER1=(COUNT=(M11,LENGTH=15))                   


if record length of the input is greater than the OUTCNT1 then this code works fine.
otherwise When record lenght is less than OUTCNT1 ( say 27), i got the following message

Code:

ICE201I 0 RECORD TYPE IS F - DATA STARTS IN POSITION 1                         
ICE222A 0 27 BYTE FIXED RECORD LENGTH IS NOT EQUAL TO 80 BYTE LRECL FOR OUTCNT1
ICE751I 0 C5-K05352 C6-Q95214 C7-K90000 C8-K05352 E9-K06751 E7-K11698


This is a generic step and the record length of the files may vary.
Please help me with this.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Wed Jan 24, 2007 9:48 pm
Reply with quote

drajagopal,

This can't be your actual ICETOOL job because the FROM ddnames don't match up with the actual ddnames. You use FROM(INFILE) and FROM(OUTFILE) but you don't have an INFILE or OUTFILE DD. You have INFILE1 and INFILE2 DDs.

Also you say
Quote:
if record length of the input is greater than the OUTCNT1 then this code works fine.
otherwise When record lenght is less than OUTCNT1 ( say 27), i got the following message


But OUTCNT1 doesn't have an LRECL so what do you mean by "when record length is less than OUTCNT1"?

To get the error message you say you got, I suspect you have LRECL=80 for OUTCNT1 and FROM(INFILE1) and FROM(INFILE2). If that's the case, then you can either remove LRECL=80 from OUTCNT1 or change your OUTFIL statement to:

Code:

   OUTFIL FNAMES=OUTCNT1,                 
     OUTREC=(80X),                         
     REMOVECC,                             
     NODETAIL,                             
     TRAILER1=(COUNT=(M11,LENGTH=15))       


In the future, please post your actual JCL so I don't have to guess at it.
Back to top
View user's profile Send private message
drajagopal

New User


Joined: 20 Jun 2006
Posts: 9

PostPosted: Thu Jan 25, 2007 10:44 am
Reply with quote

Hi Frank,

I am sorry, the statements were

COPY FROM(INFILE1) TO(OUTCNT1) USING(NFC5)
COPY FROM(INFILE2) TO(OUTCNT1) USING(NFC5)
SELECT FROM(OUTCNT1) TO(OUTCNT2) ON(1,15,ZD) NODUPS
COUNT FROM(OUTCNT2) NOTEMPTY


I tried with the option you mentioned of giving OUTREC=(80X) and it is working fine now.
Thank you.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Store the data for fixed length COBOL Programming 1
No new posts How to split large record length file... DFSORT/ICETOOL 10
Search our Forums:

Back to Top