Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 
Getting no of file from one file and writing into another

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
Daphne

New User


Joined: 28 Aug 2006
Posts: 27
Location: NY, US

PostPosted: Thu Dec 07, 2006 2:27 am    Post subject: Getting no of file from one file and writing into another
Reply with quote

Hi all,

My requirement is to get the number of records from a file and write the count into another file.


Below is the code.

//STEPX EXEC PGM=SYNCTOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//INPFILE DD DSN=inputfile name(+1),
// DISP=SHR
//OUTFILE DD DSN=outputfile name,DISP=(NEW,CATLG,DELETE),
// SPACE=(CYL,(5,3),RLSE),UNIT=TEST,
// DCB=(DSORG=PS,RECFM=FB,LRECL=50,BLKSIZE=0)
//TOOLIN DD *
COUNT FROM(INPFILE) USING(CTL1)
//*
//CTL1CNTL DD *
OUTFIL FNAMES=OUTFILE,NODETAIL,TRAILER1=('COUNT',COUNT)
/*

I am getting return code 0, but nothing is written onto the output file.

Below messages are found in the DFSMSG

CTL1CNTL :
OUTFIL FNAMES=OUTFILE,TRAILER1=('COUNT',COUNT)
PARMLIST :
OPTION RESINV=0,ARESINV=0,MSGDDN=DFSMSG,SORTIN=INPFILE,SORTDD=CTL1
SORT FIELDS=COPY
WER428I CALLER-PROVIDED IDENTIFIER IS "0001"
WER108I INPFILE : RECFM=FB ; LRECL= 80; BLKSIZE= 27920
WER055I INSERT 0, DELETE 7297
WER054I RCD IN 7297, OUT 0
WER169I RELEASE 1.1D BATCH 0426 TPF LEVEL 3A
WER052I END SYNCSORT -

Kindly help me to find what I am missing and why the output file is empty.

Thanks,
Daphne
Back to top
View user's profile Send private message

William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Thu Dec 07, 2006 2:59 am    Post subject:
Reply with quote

Not being as good as some of the people around here, I'd probably do a sort (copy?) with the input being appended/replaced with a numeric one (and a constant key?), sum the one (on the key?) and format the output with the summed one and whatever constant you like.
Back to top
View user's profile Send private message
Daphne

New User


Joined: 28 Aug 2006
Posts: 27
Location: NY, US

PostPosted: Thu Dec 07, 2006 4:02 am    Post subject: Re: COUNT FROM A FILE TO BE WRITTEN TO ANOTHER FILE - SYNCTO
Reply with quote

Hi William,

I did as per your suggestion and it works fine.

Thank you,
Daphne

For the record sake here is the JCL.

//STEP3 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//SORTIN DD DSN=input filename,DISP=SHR
//SORTOUT DD DSN=output filename,DISP=(NEW,CATLG,DELETE),
// SPACE=(CYL,(5,3),RLSE),UNIT=TEST,
// DCB=(DSORG=PS,RECFM=FB,LRECL=100,BLKSIZE=0)
//SORTWK01 DD UNIT=TEST,SPACE=(CYL,(5,3))
//SORTWK02 DD UNIT=TEST,SPACE=(CYL,(5,3))
//SORTLIST DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=(81,01,CH,A)
INREC FIELDS=(1:1,80,81:C'0',82:C'0000000001')
OUTREC FIELDS=(1:82,10)
SUM FIELDS=(82,10,ZD)
END
/*
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


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

PostPosted: Thu Dec 07, 2006 4:35 am    Post subject:
Reply with quote

I usually don't answer Syncsort questions, but I feel compelled to point out that the "solution" arrived at here is unnecessarily complicated. For a simple DFSORT solution which will probably work with Syncsort as well, see "Display the number of input or output records" Smart DFSORT Trick at:

http://www.ibm.com/servers/storage/support/software/sort/mvs/tricks/

Note that the COUNT operator of DFSORT's ICETOOL displays the count in a message in TOOLMSG - COUNT does not create an output data set so you can't count the records with OUTFIL. To get the count in a data set, use the trick indicated above. You can do the same thing with ICETOOL using a COPY operator and an OUTFIL statement.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts editting the file by inserting zeros ... pramodrsingh DFSORT/ICETOOL 9 Mon Aug 21, 2017 5:58 pm
No new posts Match two files using multiple keys a... santoshks1987 SYNCSORT 11 Fri Aug 18, 2017 10:50 am
No new posts Multiple VSAM files single output fil... Mohan Kothakota DFSORT/ICETOOL 11 Wed Aug 09, 2017 7:57 pm
This topic is locked: you cannot edit posts or make replies. rexx code to create a ps file Bharath Vikraman CLIST & REXX 4 Mon Aug 07, 2017 10:30 am
No new posts Split file based on comparsion to 2 f... Div Grad DFSORT/ICETOOL 3 Thu Jul 27, 2017 9:16 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us