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

Deleting from a header to a trailer.


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
madhav_in

New User


Joined: 21 Nov 2006
Posts: 12
Location: chennai

PostPosted: Sat Apr 21, 2007 10:15 pm
Reply with quote

Hi,
Can anyone please help me with this problem. I need to delete certain records from the header to the trailer for a particular key. now let me give you an example of the file i have.

the file is like the one given below.

header <key1>
.............
.......
,.,,,,,

trailer
header <key2>
..........
......
....
trailer
header <key3>
.........
.....
....
trailer

This is the format of my file. Now is it possible for me to delete from the header containing key2 till the trailer of the key2 using DFSORT or other utility? if so then can you please tell me how that can be done?

Thanks you for your help !!!!!! icon_smile.gif
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: Sun Apr 22, 2007 8:35 pm
Reply with quote

You can do what you asked for using the technique discussed in the "Include or omit groups of records" Smart DFSORT Trick at:

www.ibm.com/servers/storage/support/software/sort/mvs/tricks/
Back to top
View user's profile Send private message
madhav_in

New User


Joined: 21 Nov 2006
Posts: 12
Location: chennai

PostPosted: Sun Apr 22, 2007 9:20 pm
Reply with quote

Hi Frank,
Thanks for the link , but when i open it , it says the page was not found icon_sad.gif can you please look into it and tell me an alternate website where i can get that information?

Thanks in advance.
Back to top
View user's profile Send private message
madhav_in

New User


Joined: 21 Nov 2006
Posts: 12
Location: chennai

PostPosted: Sun Apr 22, 2007 10:08 pm
Reply with quote

Hi frank,
Thanks for your help . the website opens now . I will look into the examples and see if they can be used for my problem. Thanks a lot. icon_smile.gif
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: Mon Apr 23, 2007 8:35 pm
Reply with quote

Yes, the DFSORT website was down on Sunday, but it's back up today.
Back to top
View user's profile Send private message
madhav_in

New User


Joined: 21 Nov 2006
Posts: 12
Location: chennai

PostPosted: Fri Apr 27, 2007 10:08 pm
Reply with quote

Hi frank,
The example given in the PDf was just perfect. It worked well for a file with a fixed record length. But when i used the same for a variable length file it did not give the desired results. Is there some change that has to be done to the program inorder for the processing variable length files? If so can you please let me know of that ?
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: Fri Apr 27, 2007 10:44 pm
Reply with quote

You mean RECFM=VB? If so, then yes, you'd have to use a slightly different technique with the sequence number, etc after the RDW instead of at the end of the record.

If you want help with that, show me the statements you used for the RECFM=FB file, and tell me the LRECL of the VB file.
Back to top
View user's profile Send private message
madhav_in

New User


Joined: 21 Nov 2006
Posts: 12
Location: chennai

PostPosted: Sat Apr 28, 2007 9:41 pm
Reply with quote

Hi frank,
What i meant was RECFM = VB. Please find the code that i am using for the FB file given below. the LRECL of the VB file is 158.

Code:

COPY FROM(IN) TO(T1) USING(CTL1)                           
SPLICE FROM(T1) TO(OUT) ON(166,8,ZD) -                     
        WITHALL WITH(1,158) KEEPBASE USING(CTL2)           
/*                                                         
//CTL1CNTL DD *                                             
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(166:SEQNUM,8,ZD)),       
       IFTHEN=(WHEN=(35,5,CH,EQ,C'B5326'),                 
               OVERLAY=(159:49,7,166:SEQNUM,8,ZD)),         
       IFTHEN=(WHEN=NONE,                                   
               OVERLAY=(174:SEQNUM,8,ZD,                   
                166:166,8,ZD,SUB,174,8,ZD,M11,LENGTH=8))   
/*                                     
//CTL2CNTL DD *                       
  OUTFIL FNAMES=OUT,                   
  INCLUDE=(159,7,CH,EQ,C'0404950',OR,   
                   159,7,CH,EQ,C'0288989'),       
  BUILD=(1,158)                         
/*
Back to top
View user's profile Send private message
madhav_in

New User


Joined: 21 Nov 2006
Posts: 12
Location: chennai

PostPosted: Sat Apr 28, 2007 9:58 pm
Reply with quote

Hi Frank,
There is also some change in the input file that i am going to use. The actual input file is as given below.

report
aaaaaaaaaaaaaaa<key>
..........
........
......
....
report
bbbbbbbbbbbbbbb<key>
............
......
....
...
report
ccccccccccccccccc<key>
............
.......
....
...

Now what i need to do in this is that i have to remove the records from the first key ie from aaaaaaaaaaaaaa<key> till the report corresponding to that (including the report). The code i have mentioned above does the same but the first report does not get printed in the output. Please let me know how i can solve this also .

Thanks in advance icon_smile.gif
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: Mon Apr 30, 2007 9:52 pm
Reply with quote

Sorry, but I can't figure out what you want from what you've shown and said.

In your job, you seem to use C'B5326' to find the start of a report and you seem to be including reports with a key of '0404950' or '0288989'. Please show an example of your input records and what you expect for output using the real values like those, so I can see what it is you're trying to do.
Back to top
View user's profile Send private message
madhav_in

New User


Joined: 21 Nov 2006
Posts: 12
Location: chennai

PostPosted: Tue May 01, 2007 9:30 am
Reply with quote

Hi Frank,
Sorry for the trouble, In my input the header records are identified by the characters 'B5326' and followed by this is the key to each set of records. So I am using the B5326 to identify my header and the <key> to identify each set of records uniquely. The report that i have specified in the input file is just specified before the start of a header record. The input dataset is as given below.

report.
b5326.a0404950
records for 0404950
records for 0404950
records for 0404950
records for 0404950
records for 0404950
report.
b5326.a0288989
records for 0288989
records for 0288989
records for 0288989
records for 0288989
records for 0288989
records for 0288989
records for 0288989
.........
......
...

In the 35th column is the header identifier 'B5326' in my input , and in the 49th column is the key <0404950>. what is need to do is remove the reocrds from the header i.e 'B5326' till the report coming after the header.

Please let me know if this information is enough.

Thanks a lot for the trouble you take icon_smile.gif
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 May 01, 2007 8:35 pm
Reply with quote

So "report" represents a set of records?

Quote:
what is need to do is remove the reocrds from the header i.e 'B5326' till the report coming after the header.


For one specific key? Which one? Or is it for more than one specific key? Which ones? Or is it something else?

If your input file looked like this, what should the output file look like?

Code:

report 1.
b5326.a0404950
records for 0404950
records for 0404950
records for 0404950
records for 0404950
records for 0404950
report 2.
b5326.a0288989
records for 0288989
records for 0288989
records for 0288989
records for 0288989
records for 0288989
records for 0288989
records for 0288989
report 3.
...
Back to top
View user's profile Send private message
madhav_in

New User


Joined: 21 Nov 2006
Posts: 12
Location: chennai

PostPosted: Tue May 01, 2007 10:12 pm
Reply with quote

Hi Frank,
yes the report represents a set of records but the problem with my input file is that the word report is not the uniques identifier to identify a set. For this reason only i am using 'B5326' as an identifier to identify a particular. Please note that the 'B5326' i am using is just to identify the header record. All the header records begin with 'B5326'. There is only one single key ,the number following 'B5326' i.e 0404950

If i were to give the input as you have suggested above and have given an omit condition for the number '0404950' then the output should be as follows.


report 1.
b5326.a0288989
records for 0288989
records for 0288989
records for 0288989
records for 0288989
records for 0288989
records for 0288989
records for 0288989
report 3.
.........
......
...

Hope this clears your doubts. Please let me know if you have any other concerns.

Thanks a lot icon_smile.gif
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 May 01, 2007 11:51 pm
Reply with quote

Here's a DFSORT/ICETOOL job that will do what you asked for.

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN DD DSN=...  input file (VB/158)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT DD DSN=...  output file (VB/158)
//TOOLIN   DD    *
SPLICE FROM(IN) TO(OUT) ON(12,8,ZD) KEEPBASE VLENOVLY -
  WITHALL WITH(12,170) USING(CTL1)
/*
//CTL1CNTL DD *
  INREC IFTHEN=(WHEN=INIT,BUILD=(1,4,12:SEQNUM,8,ZD,28:5)),
       IFTHEN=(WHEN=(62,5,CH,EQ,C'b5326'),
               OVERLAY=(5:76,7,12:SEQNUM,8,ZD)),
       IFTHEN=(WHEN=NONE,
               OVERLAY=(20:SEQNUM,8,ZD,
                12:12,8,ZD,SUB,20,8,ZD,M11,LENGTH=8))
  OUTFIL FNAMES=OUT,
    OMIT=(5,7,CH,EQ,C'0404950'),
    BUILD=(1,4,5:28)
/*
Back to top
View user's profile Send private message
madhav_in

New User


Joined: 21 Nov 2006
Posts: 12
Location: chennai

PostPosted: Wed May 02, 2007 11:08 pm
Reply with quote

Hi Frank,
Can you please tell me the input file based on which you have created this DFSORT step ? Is the position of each of the characters in the input file vary according to the RECFM ? i.e for VB and FB are the character positions different ?
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 May 02, 2007 11:27 pm
Reply with quote

For an FB file, the first data byte starts in position 1.

For a VB file, the RDW is in positions 1-4, so the first data byte starts in position 5.

The DFSORT/ICETOOL job I gave you is based on the VB input file you gave as an example which is what I thought you asked for.

You said
Quote:
In the 35th column is the header identifier 'B5326' in my input , and in the 49th column is the key <0404950>.
I assumed you were not counting the RDW for these starting positions, so I used 39 as the starting position of the header identifer (35+4 for the RDW = 39) and 53 as the starting position for the key (49+4=53).
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Deleting a Tape file JCL & VSAM 14
No new posts CA7 deleting files in steps after job... CA Products 4
No new posts Insert header record with record coun... DFSORT/ICETOOL 14
No new posts Insert trailer for non empty file only DFSORT/ICETOOL 6
No new posts Comparing Header and Trailer. DFSORT/ICETOOL 7
Search our Forums:

Back to Top