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

DFSORT to count number of records


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

Active User


Joined: 06 Apr 2005
Posts: 180

PostPosted: Wed Apr 27, 2005 8:02 pm
Reply with quote

Hi,
I am new to mainframes.I just read about this DFSORT command in one of the posts which is for counting the number of records in the dataset.Could Someone explain how exactly the last 2 lines work and what are the functions nodetail,removecc.

//COUNT EXEC PGM=SORT
//SORTIN DD DSN=MY.DATASET,DISP=SHR
//SYSOUT DD SYSOUT=*
//SORTOUT DD DSN=MY.OUTPUT.DSN,DISP=(,CATLG,DELETE),...
//SYSIN DD DATA
OPTION COPY
OUTFIL REMOVECC,NODETAIL,
TRAILER1=(COUNT=(M10,LENGTH=10))
/*
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 Apr 27, 2005 8:30 pm
Reply with quote

VM,

Please use a meaningful Subject for future posts. "Hi" does not tell us anything about your question.

I'm you're not familiar with DFSORT or DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT Getting Started". It's an excellent tutorial, with lots of examples, that shows you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books and papers, from:

Use [URL] BBCode for External Links

Code:

  OUTFIL REMOVECC,NODETAIL,
     TRAILER1=(COUNT=(M10,LENGTH=10))


An OUTFIL statement is used to write records to an OUTFIL DD. In this case, since neither the FNAMES nor FILES parameters are specified to give the ddname, the default ddname of SORTOUT is used.

TRAILER1 writes a report trailer at the end of the report. In this case, it writes one record to SORTOUT with a 10-byte count of the number of records in the input data set. LENGTH=10 says the length of the output field is 10 bytes. M10 is an edit mask that tells DFSORT to use leading blanks for zeros in the count. So if the count is 27, it will be displayed as 'bbbbbbbb27' where each b is a blank. M11 would tell DFSORT to use leading zeros, e.g. 27 would be displayed as '0000000027'. DFSORT has 27 edit masks as well as an EDIT parameter that lets you design your own masks.

By default, DFSORT would write the data lines to the output data set. NODETAIL tells DFSORT not to write the data lines. So we only get the TRAILER1 line. Without NODETAIL, SORTOUT would have:

data record 1
data record 2
...
count record

We don't want the data records, so we use NODETAIL to suppress them.

By default, when DFSORT writes a report (triggered by the use of the OUTFIL parameters LINES, HEADER1, TRAILER1, HEADER2, TRAILER2, SECTIONS or NODETAIL) it uses ANSI carriage control characters in the first byte of the output record to tell the printer what to do (e.g. '1' means page eject). REMOVECC tells DFSORT to remove the ANSI carriage control characters. Without REMOVECC, the record in SORTOUT would look like this for an input file with 27 records (b for blank):

1bbbbbbbb27

We don't want the 1, so we use REMOVECC to remove it to get:

bbbbbbbb27

If you want to learn more about DFSORT, use the link I gave you above.
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 To get the count of rows for every 1 ... DB2 3
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Substring number between 2 characters... DFSORT/ICETOOL 2
Search our Forums:

Back to Top