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

Two input files & writing counter file


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

New User


Joined: 27 Apr 2005
Posts: 43
Location: United States

PostPosted: Tue Aug 15, 2023 5:05 am
Reply with quote

Hi IBM Sort Tools Team,

Could you please show me how to set up a ICEMAN to Read two input files and give a count of how many times the carriage control = '1' for both input files?

Looking for something like this output file
Code:
 ***************************** Top of Data *
  REGULAR BILL COUNT: 0000161
  MEMO500 BILL COUNT: 0000066
**************************** Bottom of Data


This works well for one input file...
Code:
 //S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD input-file      lrecl=133
//SORTOUT  DD output-file   lrecl=133
//SYSIN    DD    *
  OPTION COPY
  OUTFIL REMOVECC,NODETAIL,INCLUDE=(1,1,CH,EQ,C'1'),
  TRAILER1=('  REGULAR BILL COUNT: ',23:COUNT=(M11,LENGTH=7))
/*


But this code keeps writing an empty file when I use two input files. Could someone please advise? I have been try different things based on the manual and replies in this forum for 6+ hours and cant get it working right.
Code:
//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN1   DD input-file1  recl=133
//SORTIN2   DD input-file2  recl=133
//SORTOUT   DD Output-file
//SORTIN    DD *
  SELECT FROM(SORTIN1),INCLUDE=(1,1,CH,EQ,C'1'),
   TRAILER1=('  REGULAR BILL COUNT: ',23:COUNT=(M11,LENGTH=7)
  SELECT FROM(SORTIN2),INCLUDE=(1,1,CH,EQ,C'1'),
   TRAILER2=('  MEMO500 BILL COUNT: ',23:COUNT=(M11,LENGTH=7)
/*
//SYSIN     DD *           
  OPTION COPY
  OUTFIL REMOVECC,NODETAIL
/*


Thank You Very Much!
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1255
Location: Bamberg, Germany

PostPosted: Tue Aug 15, 2023 10:06 am
Reply with quote

Code:
//ICETOOL  EXEC PGM=ICETOOL                                           
//IN01     DD DISP=SHR,DSN=&SYSUID..REGULAR                           
//IN02     DD DISP=SHR,DSN=&SYSUID..MEMO500                           
//OUT01    DD SYSOUT=*                                                 
//OUT02    DD SYSOUT=*                                                 
//DFSMSG   DD SYSOUT=*                                                 
//TOOLMSG  DD SYSOUT=*                                                 
//TOOLIN   DD *                                                       
  COUNT FROM(IN01) WRITE(OUT01) TEXT('Regular count is : ') USING(CTL1)
  COUNT FROM(IN02) WRITE(OUT02) TEXT('Memo500 count is : ') USING(CTL1)
/*                                                                     
//CTL1CNTL DD *                                                       
  INCLUDE COND=(1,1,CH,EQ,C'1')                                       
/*
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1255
Location: Bamberg, Germany

PostPosted: Tue Aug 15, 2023 11:14 am
Reply with quote

Add DIGITS(7) to the COUNT statements, if you wish to format the result for less than the default.
Back to top
View user's profile Send private message
Time2Live

New User


Joined: 27 Apr 2005
Posts: 43
Location: United States

PostPosted: Tue Aug 15, 2023 8:47 pm
Reply with quote

Thank you Joerg! It works very well when I use SYSOUT=* for the output & I get both lines. But when I write to a DSN it only writes the 2nd line. How can I refine this to get both lines written to one DSN?
Code:
 //S1    EXEC  PGM=ICETOOL
//IN01    DD input-file1 1rec1=133
//IN02    DD input-file2 1rec1=133
//*OUT01   DD SYSOUT=*            <-- GOOD
//OUT01   DD output-dsn,DISP=SHR  <-- only writes 2nd rcd
//DFSMSG  DD SYSOUT=*
//TOOLMSG DD SYSOUT=*
//TOOLIN  DD *
  COUNT FROM(IN01) WRITE(OUT01) TEXT('REGULAR CNT IS: ') USING(CTL1) -
        DIGITS(5) WIDTH(80)
  COUNT FROM(IN02) WRITE(OUT01) TEXT('MEMO500 CNT IS: ') USING(CTL1) -
        DIGITS(5) WIDTH(80)
/*
//CTL1CNTL DD *
  INCLUDE COND=(1,1,CH,EQ,C'1')
/*

Only writes 2nd line
Code:
 ***************************** Top of Data 
 MEMO500 CNT IS: 00066
 **************************** Bottom of Data
Back to top
View user's profile Send private message
Garry Carroll

Senior Member


Joined: 08 May 2006
Posts: 1193
Location: Dublin, Ireland

PostPosted: Tue Aug 15, 2023 8:58 pm
Reply with quote

Quote:
Thank you Joerg! It works very well when I use SYSOUT=* for the output & I get both lines. But when I write to a DSN it only writes the 2nd line. How can I refine this to get both lines written to one DSN?


Try using DISP=MOD for the output dataset so the second record doesn't overwrite the first.

Garry.
Back to top
View user's profile Send private message
Time2Live

New User


Joined: 27 Apr 2005
Posts: 43
Location: United States

PostPosted: Tue Aug 15, 2023 9:15 pm
Reply with quote

But it will just add another line to yesterday's file and we need a fresh new file everyday. Three steps?
1. delete
2. catlg
3. Mod

Or is there a better way?
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1255
Location: Bamberg, Germany

PostPosted: Tue Aug 15, 2023 10:16 pm
Reply with quote

Time2Live wrote:
But it will just add another line to yesterday's file and we need a fresh new file everyday. Three steps?
1. delete
2. catlg
3. Mod

Or is there a better way?

Straight forward:
Code:
//WHATEVER EXEC PGM=ICETOOL                                             
//IN01     DD DISP=SHR,DSN=&SYSUID..REGULAR                             
//IN02     DD DISP=SHR,DSN=&SYSUID..MEMO500                             
//OUT01    DD DISP=OLD,DSN=&SYSUID..OUT <* preallocated                 
//OUT02    DD DISP=MOD,DSN=&SYSUID..OUT                                 
//DFSMSG   DD SYSOUT=*                                                 
//TOOLMSG  DD SYSOUT=*                                                 
//TOOLIN   DD *                                                         
 COUNT FROM(IN01) WRITE(OUT01) TEXT('Regular count is : ') USING(CTL1) -
   DIGITS(7)                                                           
 COUNT FROM(IN02) WRITE(OUT02) TEXT('Memo500 count is : ') USING(CTL1) -
   DIGITS(7)                                                           
/*                                                                     
//CTL1CNTL DD *                                                         
  INCLUDE COND=(1,1,CH,EQ,C'1')                                         
/*
Back to top
View user's profile Send private message
Time2Live

New User


Joined: 27 Apr 2005
Posts: 43
Location: United States

PostPosted: Wed Aug 16, 2023 12:16 am
Reply with quote

Thanks Joerg, I can do that

One last question to perfect it. I want to zero suppress the count of records. I know I need the EDCOUNT parm and found the definition --

EDCOUNT - specifies how the overall count is to be formatted for printing. The following formatting items
can be used (see DFSORT Application Programming Guide for complete details): mask, E'pattern', L'string',
F'string', T'string', LZ and Udd.

I have found no examples using the 'E-pattern' and have tried these and others, but keeps getting code=12 and flagging the EDCOUNT. Do you have any suggestions?
Code:
  COUNT FROM(IN02) WRITE(OUT01) TEXT('MEMO500 CNT IS: ') USING(CTL1) -
        DIGITS(5) EDCOUNT(E'ZZZZ9')
                  EDCOUNT(E'    9')
                  EDCOUNT(LZ)
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1255
Location: Bamberg, Germany

PostPosted: Wed Aug 16, 2023 1:09 am
Reply with quote

Instead of DIGITS(7) specifiy EDCOUNT(U07,A0)
Back to top
View user's profile Send private message
Time2Live

New User


Joined: 27 Apr 2005
Posts: 43
Location: United States

PostPosted: Wed Aug 16, 2023 2:32 am
Reply with quote

You are Brilliant Joerg! Thank You! It Works Great! icon_biggrin.gif
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2023
Location: USA

PostPosted: Wed Aug 16, 2023 4:46 am
Reply with quote

Time2Live wrote:
But it will just add another line to yesterday's file and we need a fresh new file everyday. Three steps?
1. delete
2. catlg
3. Mod

Or is there a better way?
Typically this is resolved in such manner:
Code:
//DELETE   EXEC PGM=IEFBR14
//OBSOLETE DD  DISP=(MOD,DELETE,DELETE),SPACE=(TRK,0),
//             DSN=&SYSUID..OUT
//*
//WHATEVER EXEC  PGM=ICETOOL
//* . . . . . .
//OUT      DD  DISP=(NEW,CATLG), . . . . . . ,
//             DSN=&SYSUID..OUT
// . . . . . . .

In this case NEW gives the same result as MOD
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1255
Location: Bamberg, Germany

PostPosted: Wed Aug 16, 2023 2:11 pm
Reply with quote

To incorporate the latest suggestions..

Code:
//CLEAN    EXEC PGM=IEFBR14                                         
//OUTPUT   DD DSN=&SYSUID..OUT,                                     
//            DISP=(MOD,DELETE,DELETE),UNIT=SYSALLDA,SPACE=(TRK,(0))
//ICETOOLC EXEC PGM=ICETOOL                                         
//IN01     DD DISP=SHR,DSN=&SYSUID..REGULAR                         
//IN02     DD DISP=SHR,DSN=&SYSUID..MEMO500                         
//OUT      DD DSN=*.CLEAN.OUTPUT,                                   
//            DISP=(MOD,CATLG,DELETE),UNIT=SYSALLDA,                 
//            SPACE=(TRK,(2,1),RLSE),                               
//            DSORG=PS,RECFM=FB,LRECL=80,BLKSIZE=0                   
//DFSMSG   DD SYSOUT=*                                               
//TOOLMSG  DD SYSOUT=*                                               
//TOOLIN   DD *                                                     
  COUNT FROM(IN01) WRITE(OUT) TEXT('Regular count is : ') -         
    USING(CTL1) WIDTH(80) EDCOUNT(U07,A0)
  COUNT FROM(IN02) WRITE(OUT) TEXT('Memo500 count is : ') -         
    USING(CTL1) WIDTH(80) EDCOUNT(U07,A0)                           
/*                                                                   
//CTL1CNTL DD *                                                     
  INCLUDE COND=(1,1,CH,EQ,C'1')                                     
/*
Back to top
View user's profile Send private message
Time2Live

New User


Joined: 27 Apr 2005
Posts: 43
Location: United States

PostPosted: Wed Aug 16, 2023 7:39 pm
Reply with quote

Yup, definitely needs MOD in the ICETOOL step to be able to write both lines. Thanks Again people! icon_smile.gif
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 TRIM everything from input, output co... DFSORT/ICETOOL 1
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
Search our Forums:

Back to Top