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 

Sum of the filelds

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


Joined: 01 Dec 2004
Posts: 82
Topics: 28

PostPosted: Thu Aug 25, 2005 6:04 am    Post subject: Sum of the filelds Reply with quote

I have Input
header
Batch header 0000000
Detail 00001
detail 00001
detail 00004
Trailer


I want the out put in the format of

header
Batch header 0000006
Detail 00001
detail 00001
detail 00004
Trailer

Is it passble thru sort Pls Help


Thanks
Cool
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: Thu Aug 25, 2005 7:00 am    Post subject: Reply with quote

coolguy,

The following JCL will give you the desired results. I assumed that your input file is FB recfm and has an lrecl of 80 bytes

Code:

//STEP0100 EXEC PGM=SORT                                   
//SYSOUT   DD SYSOUT=*                                     
//SORTIN   DD *                                           
HEADER                                                     
BATCH HEADER 0000000                                       
DETAIL 00001                                               
DETAIL 00001                                               
DETAIL 00004                                               
TRAILER                                                   
//DTL      DD DSN=&T1,DISP=(,PASS),SPACE=(CYL,(1,1,),RLSE)
//HDR      DD DSN=&T2,DISP=(,PASS),SPACE=(TRK,(1,1,),RLSE)
//SYSIN    DD *                                           
  SORT FIELDS=COPY                                         
  OUTREC FIELDS=(1,80,SEQNUM,8,ZD)                         
  OUTFIL FNAMES=DTL,OMIT=(01,12,CH,EQ,C'BATCH HEADER')     
  OUTFIL FNAMES=HDR,REMOVECC,NODETAIL,                     
  INCLUDE=(01,06,CH,EQ,C'DETAIL'),                         
  TRAILER1=(C'BATCH HEADER ',                             
            TOT=(8,5,ZD,EDIT=(TTTTTTTT)),                 
            80:X,                                         
            C'00000002')                                   
/*                                                         
//STEP0200 EXEC PGM=SORT                                   
//SYSOUT   DD SYSOUT=*                                     
//SORTIN   DD DSN=&T1,DISP=OLD                             
//         DD DSN=&T2,DISP=OLD                             
//SORTOUT  DD SYSOUT=*                                     
//SYSIN    DD *                                           
  SORT FIELDS=(81,8,CH,A)                                 
  OUTREC FIELDS=(1,80)                                     
/*


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
coolguy
Beginner


Joined: 01 Dec 2004
Posts: 82
Topics: 28

PostPosted: Thu Aug 25, 2005 7:26 am    Post subject: Reply with quote

I am sorry It is VB lenth on 511

Cool
Back to top
View user's profile Send private message
coolguy
Beginner


Joined: 01 Dec 2004
Posts: 82
Topics: 28

PostPosted: Thu Aug 25, 2005 7:32 am    Post subject: Reply with quote

and also Pic of s9(7)v99 comp-3
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: Thu Aug 25, 2005 7:57 am    Post subject: Reply with quote

coolguy,

Please Post detailed information on what you're trying to accomplish. If you keep change the requirements every 10 min , I do not have time to code an example for you. you are wasting my time as well as your time. Twisted Evil

There are some more details that I need.

1. What is position of the strings 'batch header' & 'detail' ?

2. What is the position of the summing field?

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Thu Aug 25, 2005 8:04 am    Post subject: Reply with quote

coolguy,

Also let us know the following.
1. Will there be multiple header-data-trailer combinations in the file ?
2. Is there a way to differentiate the "batch header" with rest of the records ? Do it really start as "Batch Header" ?

Thanks,
Phantom
Back to top
View user's profile Send private message
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