| sivafdms Intermediate
 
 
 Joined: 29 May 2007
 Posts: 165
 Topics: 77
 
 
 | 
			
				|  Posted: Wed Feb 02, 2011 12:42 pm    Post subject: Adding Header & Trailer records to the details records |   |  
				| 
 |  
				| Hi, 
 Can someone help me to add the header & trailer to an input file. Below is the input file with lrecl = 200 & recfm=fb.
 
 
  	  | Code: |  	  | 20VISA         20000      1982
 20MASTERCARD   50000      1980
 20DISCOVER     10000      1988
 20AMEX         90000      1970
 
 | 
 
 I want the output in the following way.The fifth & sixth column of the trailer should give no of detail records & total volume.
 
 
  	  | Code: |  	  | 10CARD       SEQ0001      02022011   JOBNAME
 20VISA         20000      1982
 20MASTERCARD   50000      1980
 20DISCOVER     10000      1988
 20AMEX         90000      1970
 90CARD       SEQ0001      02022011   JOBNAME      0000004      001700000
 
 | 
 
 
 Thanks,
 Siva
 |  | 
	
		| kolusu Site Admin
 
  
 
 Joined: 26 Nov 2002
 Posts: 12394
 Topics: 75
 Location: San Jose
 
 | 
			
				|  Posted: Wed Feb 02, 2011 1:06 pm    Post subject: |   |  
				| 
 |  
				| Sivafdms, 
 Your total is wrong. The total of values in pos 16 is only 170,000. The following DFSORT JCL will give you the desired results.
 
 
 
  	  | Code: |  	  | //STEP0100 EXEC PGM=SORT
 //SYSOUT   DD SYSOUT=*
 //SORTIN   DD *
 ----+----1----+----2----+----3----+----4--
 20VISA         20000      1982
 20MASTERCARD   50000      1980
 20DISCOVER     10000      1988
 20AMEX         90000      1970
 //SORTOUT  DD SYSOUT=*
 //SYSIN    DD *
 SORT FIELDS=COPY
 OUTFIL REMOVECC,
 HEADER1=('10CARD',14:'SEQ0001',27:DATENS=(MD4),38:'JOBNAME'),
 TRAILER1=('90CARD',14:'SEQ0001',27:DATENS=(MD4),38:'JOBNAME',
 50:COUNT=(M11,LENGTH=7),
 64:TOT=(16,5,ZD,M11,LENGTH=9))
 /*
 | 
 _________________
 Kolusu
 www.linkedin.com/in/kolusu
 |  |