|
View previous topic :: View next topic
|
| Author |
Message |
Time2Live
New User

Joined: 27 Apr 2005 Posts: 43 Location: United States
|
|
|
|
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 |
|
 |
Joerg.Findeisen
Senior Member

Joined: 15 Aug 2015 Posts: 1431 Location: Bamberg, Germany
|
|
|
|
| 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 |
|
 |
Joerg.Findeisen
Senior Member

Joined: 15 Aug 2015 Posts: 1431 Location: Bamberg, Germany
|
|
|
|
| Add DIGITS(7) to the COUNT statements, if you wish to format the result for less than the default. |
|
| Back to top |
|
 |
Time2Live
New User

Joined: 27 Apr 2005 Posts: 43 Location: United States
|
|
|
|
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 |
|
 |
Garry Carroll
Senior Member
Joined: 08 May 2006 Posts: 1216 Location: Dublin, Ireland
|
|
|
|
| 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 |
|
 |
Time2Live
New User

Joined: 27 Apr 2005 Posts: 43 Location: United States
|
|
|
|
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 |
|
 |
Joerg.Findeisen
Senior Member

Joined: 15 Aug 2015 Posts: 1431 Location: Bamberg, Germany
|
|
|
|
| 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 |
|
 |
Time2Live
New User

Joined: 27 Apr 2005 Posts: 43 Location: United States
|
|
|
|
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 |
|
 |
Joerg.Findeisen
Senior Member

Joined: 15 Aug 2015 Posts: 1431 Location: Bamberg, Germany
|
|
|
|
| Instead of DIGITS(7) specifiy EDCOUNT(U07,A0) |
|
| Back to top |
|
 |
Time2Live
New User

Joined: 27 Apr 2005 Posts: 43 Location: United States
|
|
|
|
You are Brilliant Joerg! Thank You! It Works Great!  |
|
| Back to top |
|
 |
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 2272 Location: USA
|
|
|
|
| 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 |
|
 |
Joerg.Findeisen
Senior Member

Joined: 15 Aug 2015 Posts: 1431 Location: Bamberg, Germany
|
|
|
|
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 |
|
 |
Time2Live
New User

Joined: 27 Apr 2005 Posts: 43 Location: United States
|
|
|
|
Yup, definitely needs MOD in the ICETOOL step to be able to write both lines. Thanks Again people!  |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|