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

Count the number of records in inputfile and write output fi


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

New User


Joined: 31 May 2005
Posts: 16

PostPosted: Thu Feb 19, 2009 10:33 am
Reply with quote

Hi,

I have a requirement to count the number of records in the input file and write to an output file.

The requirement is like i have 10 input datasets and the number of records in each dataset should be written as separate record in a single output file.

Kindly help me in this case!

Thanks and regards
Renjith
Back to top
View user's profile Send private message
renjithravi1
Warnings : 2

New User


Joined: 31 May 2005
Posts: 16

PostPosted: Thu Feb 19, 2009 11:38 am
Reply with quote

Hi,

I have already tried for one dataset by using the following code,

Code:

//S020        EXEC PGM=ICETOOL,     
//TOOLMSG DD   SYSOUT=*                                     
//DFSMSG   DD   SYSOUT=*                                 
//IN            DD 
//OUT         DD 
//TOOLIN    DD  *                                             
  COUNT FROM(IN) WRITE(OUT)                                 
/*             
                                             


But getting the error
Code:

            COUNT FROM(IN) WRITE(OUT)               
                           $                       
ICE604A 0 ERROR IN KEYWORD, PARAMETER, OR DELIMITER
Back to top
View user's profile Send private message
Garry Carroll

Senior Member


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

PostPosted: Thu Feb 19, 2009 2:42 pm
Reply with quote

ICETOOL's COUNT will write the count to TOOLMSG.

What you could do is set TOOLMSG to a dataset and then select the lines with the information you need and format output records from those.

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

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Thu Feb 19, 2009 2:49 pm
Reply with quote

Or even something like this.
Code:
//OUT        DD DSN=Output file,DISP=MOD
//TOOLIN     DD  *                                             
  COPY FROM(IN1) TO(OUT) USING(CTL1)                                 
  COPY FROM(IN2) TO(OUT) USING(CTL1)
......
......
//CTL1CNTL   DD *
  OPTION COPY
  OUTFIL FNAMES=OUT,REMOVECC,NODETAIL,TRAILER1=(COUNT)
Back to top
View user's profile Send private message
renjithravi1
Warnings : 2

New User


Joined: 31 May 2005
Posts: 16

PostPosted: Thu Feb 19, 2009 4:48 pm
Reply with quote

Hi,

Thanks you very much for the answer. I have tried and it has been working. But i have one more requirement of print a certain text also with the number of records like,

FILE100010
FILE200012

Is is possible in ICETOOL?

Thanks and regards
Renjith
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: Thu Feb 19, 2009 10:21 pm
Reply with quote

The error message for:

Code:

 COUNT FROM(IN) WRITE(OUT)


indicates that you don't have z/OS DFSORT V1R5 PTF UK90013 (July, 2008) installed. You need that PTF to use the WRITE function. Ask your System Programmer to install the PTF (it's free).

Once you have that PTF installed, you can do what you want using a DFSORT/ICETOOL job like this:

Code:

//S1   EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN1 DD DSN=...  input file1
//IN2 DD DSN=...  input file1
...
//IN10 DD DSN=...  input file10
//CT1 DD DSN=...   output file1
//CT2 DD DSN=...   output file2
...
//CT10 DD DSN=...  output file10
//TOOLIN DD *
COUNT FROM(IN1) TEXT('FILE1') WRITE(CT1) DIGITS(5)
COUNT FROM(IN2) TEXT('FILE2') WRITE(CT2) DIGITS(5)
...
COUNT FROM(IN10) TEXT('FILE10') WRITE(CT10) DIGITS(5)
/*


Alternatively, you could do it with this DFSORT/ICETOOL job that doesn't require the PTF:

Code:

//S2   EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN1 DD DSN=...  input file1
//IN2 DD DSN=...  input file1
...
//IN10 DD DSN=...  input file10
//CT1 DD DSN=...   output file1
//CT2 DD DSN=...   output file2
...
//CT10 DD DSN=...  output file10
//TOOLIN DD *
COPY FROM(IN1) USING(CTL1)
COPY FROM(IN2) USING(CTL2)
...
COPY FROM(IN10) USING(CTLA)
/*
//CTL1CNTL DD *
  OUTFIL FNAMES=CT1,REMOVECC,NODETAIL,
    TRAILER1=('FILE1',COUNT=(EDIT=(TTTTT)))
/*
//CTL2CNTL DD *
  OUTFIL FNAMES=CT2,REMOVECC,NODETAIL,
    TRAILER1=('FILE2',COUNT=(EDIT=(TTTTT)))
/*
...
//CTLACNTL DD *
  OUTFIL FNAMES=CT10,REMOVECC,NODETAIL,
    TRAILER1=('FILE10',COUNT=(EDIT=(TTTTT)))
/*
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(F1 & F2) and writ... JCL & VSAM 6
No new posts TRIM everything from input, output co... DFSORT/ICETOOL 1
No new posts To get the count of rows for every 1 ... DB2 3
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
Search our Forums:

Back to Top