IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Help me to sort this file which has a few headers


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
tarunbhardwajleo

New User


Joined: 23 Feb 2007
Posts: 25
Location: Dallas, TX

PostPosted: Tue Feb 27, 2007 2:55 am
Reply with quote

I have a fixed block file which has a few headers, a number of detail records and a few trailers.
1. The header record has its first two bytes as '10', followed by a timestamp when that header was created.
2. The detail record has its first two bytes as '20'.
3. The trailer record has its first two bytes as '30', followed by a number in the packed decimal format S9(9) Comp-3
4. The number of headers would always be equal to the number of trailers.

I want to build a file out of it that has just the first header present in the given file and just one trailer. In the trailer record that I finally get, the first two bytes, that is '30' should be followed by the sum of numbers present in all the trailer records in the packed decimal format. The detail records should be untouched and should be present in the file without any editing.

Can any one please help me out with this ??? Thanks in advance !

The file looks something like.....

Code:
Command ===>                                                  Scroll ===> CSR
****** ***************************** Top of Data *****************************
000001 101999-12-30-23.38.22.113649                                           
000002 205319457130004002       AA   NN                                     
000003 209000001360112006       BP   YN                                     
000004 206191145740208003       CVM  YN                                     
000005 30.....                                                                 
000006 101999-12-30-23.38.22.329272                                           
000007 205319390000001016       DV   NN                                     
000008 209000001360121007       BP   YN                                     
000009 206111210000001014       BP   YN                                     
000010 30.....                                                                 
****** **************************** Bottom of Data ***************************
[/code]
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Tue Feb 27, 2007 3:44 am
Reply with quote

Here's a DFSORT job that will do what you asked for. I assumed your input file has RECFM=FB and LRECL=80, but the job can be changed for other attributes.

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (FB/80)
//SORTOUT DD DSN=...  output file (FB/80)
//SYSIN    DD    *
  OPTION EQUALS
* Reformat '30' records to:
* |30|pdfld|data|00000000|pdfld|
  INREC IFTHEN=(WHEN=(1,2,CH,EQ,C'30'),
      OVERLAY=(81:8C'0',89:3,5)),
* Reformat '10' records to:
* |10|data......|00000000|PD'0'|
    IFTHEN=(WHEN=(1,2,CH,EQ,C'10'),
      OVERLAY=(81:8C'0',89:X'000000000C')),
* Reformat '20' records to:
* |20|data......|seqnum..|PD'0'|
    IFTHEN=(WHEN=NONE,
      OVERLAY=(81:SEQNUM,8,ZD,89:X'000000000C'))
* Sort on type and seqnum, and sum on pdfld in 89-93.
* This will give us the first '10' record.
* This will give us all of the '20' records.
* This will give us the first '30' record with the sum of
* the pd fields from all of the '30' records in 89-93.
  SORT FIELDS=(1,2,CH,A,81,8,ZD,A)
  SUM FIELDS=(89,5,PD)
* For the '30' record, copy the sum of the pd fields
* from 89-93 to 3-7.  Set record length to 80.
  OUTREC IFOUTLEN=80,
    IFTHEN=(WHEN=(1,2,CH,EQ,C'30'),
      OVERLAY=(3:89,5))
/*
Back to top
View user's profile Send private message
tarunbhardwajleo

New User


Joined: 23 Feb 2007
Posts: 25
Location: Dallas, TX

PostPosted: Tue Feb 27, 2007 9:51 pm
Reply with quote

Hi Frank,

thanks for your reply. Though my file has a record length of 84 but I would adjust that once I hit your solution correctly. Could you please provide me a pointer to some manual/user reference guide on ICEMAN ? I tried to run the solution provided by you but it gave me a few errors like
Code:
SYSIN :                                                               
  OPTION EQUALS                                                       
 * REFORMAT '30' RECORDS TO:                                           
 *                                                                     
 * |30|PDFLD|DATA|00000000|PDFLD|                                     
 *                                                                     
   INREC IF THEN=(WHEN=(1,2,CH,EQ,C'30'),                             
         *                                                             
       OVERLAY=(81:8C'0',89:3,5)),                                     
       *                                                               
 * REFORMAT '10' RECORDS TO:                                           
 *                                                                     
 * |10|DATA......|00000000|PD'0'|                                     
 *                                                                     
     IFTHEN=(WHEN=(1,2,CH,EQ,C'10'),                                   
     *                                                       
       OVERLAY=(81:8C'0',89:X'000000000C')),                 
       *                                                     
 * REFORMAT '20' RECORDS TO:                                 
 *                                                           
 * |20|DATA......|SEQNUM..|PD'0'|                           
 *                                                           
     IFTHEN=(WHEN=NONE,                                     
     *                                                       
       OVERLAY=(81:SEQNUM,8,ZD,89:X'000000000C'))           
       *                                                     
 * SORT ON TYPE AND SEQNUM, AND SUM ON PDFLD IN 89-93.       
 *                                                           
 * THIS WILL GIVE US THE FIRST '10' RECORD.                 
 *                                                           
 * THIS WILL GIVE US ALL OF THE '20' RECORDS.               
 *                                                           
 * THIS WILL GIVE US THE FIRST '30' RECORD WITH THE SUM OF   
 *                                                           
 * THE PD FIELDS FROM ALL OF THE '30' RECORDS IN 89-93.
 *                                                     
   SORT FIELDS=(1,2,CH,A,81,8,ZD,A)                     
   SUM FIELDS=(89,5,PD)                                 
 * FOR THE '30' RECORD, COPY THE SUM OF THE PD FIELDS   
 *                                                     
 * FROM 89-93 TO 3-7.  SET RECORD LENGTH TO 80.         
 *                                                     
   OUTREC IFOUTLEN=80,                                 
          *                                             
     IFTHEN=(WHEN=(1,2,CH,EQ,C'30'),                   
       OVERLAY=(3:89,5))                               
 /*                                                     
 *                                                     
WER275A  NO KEYWORDS FOUND ON CONTROL STATEMENT         
WER275A  NO KEYWORDS FOUND ON CONTROL STATEMENT         
WER268A  INREC STATEMENT   : SYNTAX ERROR               
WER275A  NO KEYWORDS FOUND ON CONTROL STATEMENT         
WER275A  NO KEYWORDS FOUND ON CONTROL STATEMENT         
WER275A  NO KEYWORDS FOUND ON CONTROL STATEMENT         
WER275A  NO KEYWORDS FOUND ON CONTROL STATEMENT         
WER275A  NO KEYWORDS FOUND ON CONTROL STATEMENT         
WER275A  NO KEYWORDS FOUND ON CONTROL STATEMENT         
WER275A  NO KEYWORDS FOUND ON CONTROL STATEMENT         
WER275A  NO KEYWORDS FOUND ON CONTROL STATEMENT         
WER275A  NO KEYWORDS FOUND ON CONTROL STATEMENT         
WER275A  NO KEYWORDS FOUND ON CONTROL STATEMENT         
WER275A  NO KEYWORDS FOUND ON CONTROL STATEMENT         
WER275A  NO KEYWORDS FOUND ON CONTROL STATEMENT         
WER275A  NO KEYWORDS FOUND ON CONTROL STATEMENT         
WER275A  NO KEYWORDS FOUND ON CONTROL STATEMENT         
WER275A  NO KEYWORDS FOUND ON CONTROL STATEMENT         
WER275A  NO KEYWORDS FOUND ON CONTROL STATEMENT         
WER268A  OUTREC STATEMENT  : SYNTAX ERROR               
WER275A  NO KEYWORDS FOUND ON CONTROL STATEMENT         
WER211B  SYNCSMF  CALLED BY SYNCSORT; RC=0000           


The job abended with ABEND0016. Could you please help me out with this ? Providing a link to a ICEMAN tutorial also might be of help. So I can go thru that and figure out the solution.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Tue Feb 27, 2007 11:28 pm
Reply with quote

tarunbhardwajleo wrote:
Hi Frank,

thanks for your reply. Though my file has a record length of 84 but I would adjust that once I hit your solution correctly. Could you please provide me a pointer to some manual/user reference guide on ICEMAN ? I tried to run the solution provided by you but it gave me a few errors like
.
.
.
WER268A INREC STATEMENT : SYNTAX ERROR
.
.
.
The job abended with ABEND0016. Could you please help me out with this ? Providing a link to a ICEMAN tutorial also might be of help. So I can go thru that and figure out the solution.
This is Syncsort, and you will need to check a syncsort manual to to do this.
Do you have access to your shops manual?
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Wed Feb 28, 2007 12:25 am
Reply with quote

tarunbhardwajleo,

The job I gave you works fine with DFSORT. But the WER messages indicate you're using Syncsort, not DFSORT. I could give you links to the DFSORT books which are available on the web. But since you're using Syncsort, you'll need Syncsort books, not DFSORT books. AFAIK, the Syncsort books are not available on the web.
Back to top
View user's profile Send private message
tarunbhardwajleo

New User


Joined: 23 Feb 2007
Posts: 25
Location: Dallas, TX

PostPosted: Wed Feb 28, 2007 12:25 am
Reply with quote

Hi William,

I have a manual, but it doesnt seem to be descriptive enough.... it has no mention of how to use the IFTHEN clause.... could you please provide me with one ?
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Feb 28, 2007 12:34 am
Reply with quote

Hello,

You are not using the sort product that Frank supports (DFSORT).

You are using Syncsort and need to refer to your site's Syncsort documentation.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Wed Feb 28, 2007 12:35 am
Reply with quote

tarunbhardwajleo wrote:
I have a manual, but it doesnt seem to be descriptive enough.... it has no mention of how to use the IFTHEN clause.... could you please provide me with one ?
Basically, (I think) everything you want to do could be done with Syncsort, Omit duplicate "10" headers, summing duplicate "30" trailers and maintaining current sequence of the data "20" records (though maybe in the same pass?).
My 1.2 Programmer's Guide does some examples of headers and trailers in "How to Use SyncSort?s Data Utility Features". Do you have that manual?
Back to top
View user's profile Send private message
tarunbhardwajleo

New User


Joined: 23 Feb 2007
Posts: 25
Location: Dallas, TX

PostPosted: Wed Feb 28, 2007 12:49 am
Reply with quote

Thats right. I want to omit duplicate "10" headers, sum duplicate "30" trailers and maintain current sequence of the data "20" records, all of them in the same pass.
I do not have "How to Use SyncSort?s Data Utility Features". Could you please provide me with the link to that manual ? Thanks in advance !
Back to top
View user's profile Send private message
sril.krishy

Active User


Joined: 30 Jul 2005
Posts: 183
Location: hyderabad

PostPosted: Wed Feb 28, 2007 4:29 pm
Reply with quote

Hi William,
It could be a lot of help for us if you put the link for the manual.

Thank you
Krishy
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Wed Feb 28, 2007 4:39 pm
Reply with quote

sril.krishy wrote:
It could be a lot of help for us if you put the link for the manual.
Sorry, it is copyrighted.
If your shop is licensed, you could check with Syncsort's support site.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 4
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top