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 

Sort Detail; Create Header,Trailer;Add Batch# from 2nd file

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


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Thu Jun 14, 2007 4:03 pm    Post subject: Sort Detail; Create Header,Trailer;Add Batch# from 2nd file Reply with quote

I have only detail records in an 80 char fixed length input file
I have a batch number in another file, but the batch number can be placed in another DFSORT input area if easier. I am generating the JCL on the fly, I need a muster (boiler plate) for the control cards necessary to add a header record, and trailer record as indicated below:

Generated Header Record:
'HEADER RECORD' ................ in pos 01- 13 of generated header record
current-date............yymmdd in pos 20- 25 of generated header record
current-time............hhmmss in pos 30 - 35 of generated header record
batch-number.......99999999 in pos 40 - 47 of generated header record
source of batch-number is pos 1-8 of 80 char record of another file which only has 1 record.
Code:

12345678901234567890123456789012345678901234567890...
HEADER RECORD      YYMMDD    HHMMSS    99999999


Generated Trailer Record:
'TRAILER RECORD'............. in pos 01-14 of generated trailer record and
the count of detail records in pos 20-28 of generated trailer record and
the total count ................. in pos 30-38 [= count of detail records(in pos 20-28 ) + 2] of generated trailer record
Code:

12345678901234567890123456789012345678901234567890...
TRAILER RECORD     999999999 999999999



sort cols 1 for 20, char type ascending
Record length is 80 Fixed for input and output file.
_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Thu Jun 14, 2007 4:11 pm    Post subject: Reply with quote

Phantom,

thx, got my answer from:
http://www.mvsforums.com/helpboards/viewtopic.php?t=8587
_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


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

PostPosted: Thu Jun 14, 2007 4:18 pm    Post subject: Reply with quote

Good...but I do not think that link answers your query since you have dynamic data in your header file - You need to do in 2 pass for this using ICETOOL/SYNCTOOL.

Well...if you still need an answer let us know.

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


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

PostPosted: Thu Jun 14, 2007 4:22 pm    Post subject: Reply with quote

dbzTHEdinosauer,

Try this

Code:

//STEP0100 EXEC PGM=SORT                                 
//SYSOUT   DD SYSOUT=*                                   
//SORTIN   DD dsn=your batch file,
//            disp=shr
//SORTOUT  DD DSN=&T1,DISP=(,PASS),SPACE=(TRK,(1,1),RLSE)
//SYSIN    DD *                                         
  OPTION COPY,STOPAFT=1                                 
  OUTREC OVERLAY=(10:DATE1)                             
  OUTFIL OUTREC=(C'BNO,C''',1,8,C'''',/,                 
                 C'CDATE,C''',12,8,C'''',80:X)           
/*                                                       
//STEP0200 EXEC PGM=SORT             
//SYMNAMES DD DSN=&T1,DISP=OLD       
//SYSOUT   DD SYSOUT=*               
//SORTIN   DD dsn=your file to be counted,
//            disp=shr               
//SORTOUT  DD SYSOUT=*               
//SYSIN    DD *                       
  SORT FIELDS=(01,20,CH,A)           
  OUTFIL REMOVECC,                   
  HEADER1=(01:C'HEADER RECORD',       
           20:CDATE,                 
           30:TIME,                   
           40:BNO),                   
 TRAILER1=(01:C'TRAILER RECORD',     
           30:COUNT+2=(M11,LENGTH=8))
/*
Back to top
View user's profile Send private message Send e-mail Visit poster's website
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Thu Jun 14, 2007 4:32 pm    Post subject: Reply with quote

Phantom, kolusu,

thank you both. downloaded to my pc and saved....................
_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
mahen246
Beginner


Joined: 15 Jun 2007
Posts: 1
Topics: 0
Location: India

PostPosted: Wed Jun 20, 2007 4:48 pm    Post subject: Reply with quote

Hi Kolusu,
Do I remove page break in trailer record using sort card.

Regards,
Mahen
_________________
Mahen
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Thu Jun 21, 2007 6:17 am    Post subject: Reply with quote

Quote:

Hi Kolusu,
Do I remove page break in trailer record using sort card


mahen246,

I have no idea as to what you are talking about

Kolusu
_________________
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

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 Jun 21, 2007 8:42 am    Post subject: Reply with quote

Mahen246,

Is your question specific to the solution posted by Kolusu or is it a general query about report writing ?

Are you asking us - "How" to remove the ANSI control characters from the report ? If so, you need to use the REMOVECC parm - but this is already present in the JCL kolusu provided.

Code:

OUTFIL REMOVECC,                   
  HEADER1=(01:C'HEADER RECORD',       
           20:CDATE,                 
           30:TIME,                   
           40:BNO),                   
 TRAILER1=(01:C'TRAILER RECORD',     
           30:COUNT+2=(M11,LENGTH=8))


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