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 

Trailer Issue!

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL)
View previous topic :: View next topic  
Author Message
Rahull
Beginner


Joined: 29 Jan 2004
Posts: 62
Topics: 19

PostPosted: Wed May 16, 2007 11:24 am    Post subject: Trailer Issue! Reply with quote

Hi,

Please help me figure out how to obtain the below result:

Problem : I have an input file with header, detail and trailer record. File length is 80 byte and record layout for trailer is :
Code:

05  W-Z5BS-TRL-SEG-ID          PIC XXX  VALUE '999'
05  W-Z5BS-TRL-REC-COUNT       PIC 9(7).           
05  FILLER                     PIC X(70) VALUE SPAC

Trailer count = Number of detail records excluding header record.

I need to run a SORT utility and concatenate the above file with another flat file (LRECL = 80) with all detail records.

Final Output = Header + Detail records original + Detail records from second file + Trailer record (Updated with new record count).

Sample input File 1 :
Code:

51070516070515  (Header)
5128274967HOL20070603  (Detail 1)
5144358641HOL20070511  (Detail 2)
9990000002  (Trailer)

Input file 2:
Code:

5106027397HOA20070613 (Detail 3)
5106027398HOA20070613  (Detail 4)

Output file:
Code:

51070516070515  (Header)
5128274967HOL20070603  (Detail 1)
5144358641HOL20070511  (Detail 2)
5106027397HOA20070613  (Detail 3)
5106027398HOA20070613 (Detail 4)
9990000004  (Trailer)
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: Wed May 16, 2007 12:13 pm    Post subject: Reply with quote

Rahull,

Try this job.

Code:

//STEP0100 EXEC PGM=SORT                       
//SYSOUT   DD SYSOUT=*                         
//SORTIN   DD DSN=Your input file 1,
//            DISP=SHR
//         DD DSN=Your input file 2,
//            DISP=SHR
//SORTOUT  DD SYSOUT=*                         
//SYSIN    DD *                               
  OMIT COND=(1,3,CH,EQ,C'999')                 
  SORT FIELDS=COPY                             
  OUTFIL REMOVECC,                             
  TRAILER1=('999',COUNT-1=(M11,LENGTH=7),80:X)
/*                                             


Hope this helps...

Cheers

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
Nic Clouston
Advanced


Joined: 01 Feb 2007
Posts: 1075
Topics: 7
Location: At Home

PostPosted: Wed May 16, 2007 12:55 pm    Post subject: Reply with quote

Quote:

I need to run a SORT utility

So why is this posted in the JCL section and not in the Utilities section? I was looking forward to a nice juicy JCL problem to try resolve Mad
_________________
Utility and Program control cards are NOT, repeat NOT, JCL.
Back to top
View user's profile Send private message
CraigG
Intermediate


Joined: 02 May 2007
Posts: 202
Topics: 0
Location: Viginia, USA

PostPosted: Wed May 16, 2007 2:34 pm    Post subject: Reply with quote

Nic Clouston wrote:
Quote:

I need to run a SORT utility

So why is this posted in the JCL section and not in the Utilities section? I was looking forward to a nice juicy JCL problem to try resolve Mad


Some people don't know the difference between JCL and program (utility)control cards.
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: Wed May 16, 2007 6:23 pm    Post subject: Reply with quote

Quote:

So why is this posted in the JCL section and not in the Utilities section? I was looking forward to a nice juicy JCL problem to try resolve


Nic,

He is one of the Elite posters who does not post a feedback for the solutions he received in here. we will just be remembered when he gets another problem, till then .... Evil or Very Mad Evil or Very Mad

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
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL) 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