MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Record count

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
subbuy2k
Beginner


Joined: 12 Aug 2004
Posts: 29
Topics: 18

PostPosted: Mon Jun 06, 2005 1:46 pm    Post subject: Record count Reply with quote

Hi,
i have to create an output file which has a header, detailed records and finally a trailer

this detailed record will be avialable in one seperate file which i can use as a input.

The trailer is constant.The value will be "TRAILER EOF "
The header will vary based on the record count and date.the format is "HEADER YYYYMMDD COUNT"
If there are 50 records today in the detail file then the header will be HEADER 20050606 50"

is it possible to do that in Jcl itself. can any one helpme to do it.

Thanks
subbu
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12369
Topics: 75
Location: San Jose

PostPosted: Mon Jun 06, 2005 2:10 pm    Post subject: Reply with quote

subbuY2K,

The following JCL will give you the desired results. In the first step we take the detail file and create the header record with the count. In the next step we concatenate this file to the detail file and create the desired output file.

Code:

//STEP0100 EXEC PGM=SORT   
//SYSOUT   DD SYSOUT=*     
//SORTIN   DD DSN=YOUR DETAIL FILE,
//            DISP=SHR
//SORTOUT  DD DSN=&T1,DISP=(,PASS),SPACE=(TRK,(1,1),RLSE)
//SYSIN    DD *                           
  SORT FIELDS=COPY                         
  OUTFIL NODETAIL,REMOVECC,               
  TRAILER1=('HEADER  ',DATENS=(4MD),COUNT)
/*                                         
//STEP0200 EXEC PGM=SORT   
//SYSOUT   DD SYSOUT=*     
//SORTIN   DD DSN=&T1,DISP=OLD
//         DD DSN=YOUR DETAIL FILE,
//            DISP=SHR
//SORTOUT  DD DSN=YOUR OUTPUT FILE,
//            DISP=(NEW,CATLG,DELETE),
//            UNIT=SYSDA,
//            SPACE=(CYL,(X,Y),RLSE)
//SYSIN    DD *             
  SORT FIELDS=COPY         
  OUTFIL REMOVECC,         
  TRAILER1=('TRAILER EOF') 
/*                         


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Mon Jun 06, 2005 2:40 pm    Post subject: Reply with quote

Here are two more ways to do this with DFSORT. You can use various forms of COUNT=(...) to change the way the count is displayed.

Method 1

Code:

//S1       EXEC PGM=ICETOOL
//TOOLMSG  DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN   DD DSN=...   input file
//OUT DD DISP=MOD,DSN=...  output file
//TOOLIN   DD *
  COPY FROM(IN) USING(CTL1)
  COPY FROM(IN) USING(CTL2)
//CTL1CNTL DD *
  OUTFIL FNAMES=OUT,NODETAIL,REMOVECC,
    TRAILER1=('HEADER',X,DATENS=(4MD),X,COUNT=(M11,LENGTH=5))
/*
//CTL2CNTL DD *
  OUTFIL FNAMES=OUT,REMOVECC,
    TRAILER1=('TRAILER EOF')
/*


Method 2

Code:

//STEP1 EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN   DD DSN=...   input file
//SORTOUT DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(5,5)),DISP=(,PASS)
//SYSIN    DD    *
 OPTION COPY
 OUTFIL REMOVECC,NODETAIL,
        TRAILER1=(C'MYCT,''',COUNT=(M11,LENGTH=5),C'''',80:X)
/*
//STEP2 EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SORTIN   DD DSN=...   input file
//SORTOUT DD DSN=...  output file
//SYSIN    DD    *
 OPTION COPY
 OUTFIL REMOVECC,
    HEADER1=('HEADER',X,DATENS=(4MD),X,MYCT),
    TRAILER1=('TRAILER EOF')
/*

_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group