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

Update trailer count through sort card


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

New User


Joined: 20 Dec 2007
Posts: 54
Location: Hyderabad

PostPosted: Thu Dec 16, 2010 11:10 am
Reply with quote

Hi,

I have a requirement where i have header records, trigger records and trailer record.

Trigger records have different triggers along with customer IDs.
My requirement is i have to separate triggers with values 41 and 42 (There are triggers with values 10 to 42) sort by Customer ID and eliminate triggers which have same customer ID for 41 and 42.

What i have planned is
1. Separate the headers and trailers.
2. Separate records with other than 41 and 42 into one file
3 .Separate records with 41 and 42 into one file, sort by customer id and sum fields = none.

4. Now my problem is how do i update the correct trailer count when i am merging back the files.

Can you please help me with this.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Thu Dec 16, 2010 11:48 am
Reply with quote

It might help if you post a few sample input records showing relevant fields and the expected output using "Code" tags.

Also the sort product version info which could be found in your SYSOUT.
Input/Output file attributes.
Starting position,length and format of relevant fields.
Back to top
View user's profile Send private message
surya anem

New User


Joined: 20 Dec 2007
Posts: 54
Location: Hyderabad

PostPosted: Fri Dec 17, 2010 10:48 am
Reply with quote

Arun,

The header has low values in the first 8 bytes.
The trailer has high values in the first 8 bytes followed by trailer count of 9 bytes.

The trigger records have triggers (41,42) in teh position 74 and length of 4 bytes.

Sort version is V1R10.

I have thought of the 4 steps i mentioned above. please suggest if there is still a better way.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Fri Dec 17, 2010 11:07 am
Reply with quote

surya anem,

Which sort product you are having? DFSORT? Syncsort? Or something else?
Quote:
The trigger records have triggers (41,42) in teh position 74 and length of 4 bytes
If you're planning to achieve it using your sort product, it requires the knowledge of the 'format' of the fields. How does '41' and '42' occupy 4 bytes? Mention the starting position,length and format of all relevant fields.

Are you trying to split the file into two based on the 'trigger' value - One file having 'trigger' 41/42 and the other with the rest with header and trailer records in both the output files?
Back to top
View user's profile Send private message
surya anem

New User


Joined: 20 Dec 2007
Posts: 54
Location: Hyderabad

PostPosted: Fri Dec 17, 2010 11:33 am
Reply with quote

Input:
Hhhhhhhh-header
00150010B011482496322
00150020B021482496322
00150041B041482496331
00150041B041482496331
00150042B041482496331
00150042B041480194269
00150042B041480194269
00150042B041474339543
00150042B041474339552
00150042B041474340078
00150058B051474340078
00150060B061474340229
Ttttt-trailer count -12

Output:
Hhhhhhhh-header
00150010B011482496322
00150020B021482496322
00150041B041482496331
Removed
Removed
00150042B041480194269
Removed
00150042B041474339543
00150042B041474339552
00150042B041474340078
00150058B051474340078
00150060B061474340229
Ttttt-trailer count -09
Say lrecl=80 for both fields


The column in red color is the trigger and the one in Blue is the customer id.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Fri Dec 17, 2010 11:35 am
Reply with quote

surya anem,

It is going to be difficult for somebody to help you unless you show some level of co-operation and respond to any of the questions raised so far.
Back to top
View user's profile Send private message
surya anem

New User


Joined: 20 Dec 2007
Posts: 54
Location: Hyderabad

PostPosted: Fri Dec 17, 2010 12:44 pm
Reply with quote

Hi Arun,

Thanks a lot for the help. I think i can use the below sort card to acheive the above requirement.

I am really sorry if i was not clear with the requirement.

INREC IFTHEN=(WHEN=INIT,OVERLAY=(731:SEQNUM,10,ZD)),
IFTHEN=(WHEN=(74,4,CH,EQ,C'0041'),OVERLAY=(731:C'9999999998')),
IFTHEN=(WHEN=(74,4,CH,EQ,C'0042'),OVERLAY=(731:C'9999999998')),
IFTHEN=(WHEN=(5,8,CH,EQ,X'FFFFFFFFFFFFFFFF'),
OVERLAY=(731:C'9999999999'))
SORT FIELDS=(731,10,ZD,A,81,10,CH,A)
SUM FIELDS=NONE
OUTREC IFTHEN=(WHEN=INIT,OVERLAY=(741:SEQNUM,10,ZD)),
IFTHEN=(WHEN=(731,10,CH,EQ,C'9999999999'),
OVERLAY=(13:742,9,ZD,SUB,+2,TO=ZD,LENGTH=9))

Thanks Abish for helping me with the sort card.

Thanks,
Surya
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Fri Dec 17, 2010 12:54 pm
Reply with quote

Quote:
Thanks Abish for helping me with the sort card.


there is no trace of any Abish posting over here

Good manners suggest that all help should be sharable by anybody on a forum/list and given as a forum reply/post

If You prefer private help You should not post on any forum/list and negotiate personally with people icon_evil.gif
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Fri Dec 17, 2010 2:24 pm
Reply with quote

Quote:
I think i can use the below sort card to acheive the above requirement
May be not. The sort card posted above may create different output during multiple runs for the same input data.

Anyways it's your problem. We are least bothered if you are ready to go with it. icon_lol.gif
Back to top
View user's profile Send private message
Guest







PostPosted: Fri Dec 17, 2010 3:04 pm
Reply with quote

Hi Arun,
Below is the requirement:

Hhhhhhhh-header
00150010B011482496322
00150020B021482496322
00150041B041482496331
00150041B041482496331
00150042B041482496331
00150042B041480194269
00150042B041480194269
00150042B041474339543
00150042B041474339552
00150042B041474340078
00150058B051474340078
00150060B061474340229
Ttttt-trailer count -12


Hhhhhhhh-header
00150010B011482496322
00150020B021482496322
00150058B051474340078
00150060B061474340229
00150041B041482496331
00150042B041480194269
00150042B041474339543
00150042B041474339552
00150042B041474340078
Ttttt-trailer count -09

Assumptions:
1) File length is 730
2) The value 0041 and 0042 is present in position 74, length 4
3) Maximum records in the file - 999999999
4) the customer id is in position 81, length 10

Note:
1) field in bold has 0041 & 0042
2) field underlined is Customer id

Used card:

Code:

//TOOLIN   DD *                                                       
  COPY FROM(IN) TO(OUT1) USING(CTL1)                                 
/*                                                                   
//CTL1CNTL DD *                                                       
  INREC IFTHEN=(WHEN=INIT,
                    OVERLAY=(701:SEQNUM,10,ZD)),               
            IFTHEN=(WHEN=(74,4,CH,EQ,C'0041'),
                    OVERLAY=(701:C'9999999998')),   
            IFTHEN=(WHEN=(74,4,CH,EQ,C'0042'),
                    OVERLAY=(701:C'9999999998')),   
            IFTHEN=(WHEN=(5,8,CH,EQ,X'FFFFFFFFFFFFFFFF'),                     
                    OVERLAY=(701:C'9999999999'))                           
   SORT FIELDS=(701,10,ZD,A,81,10,CH,A)                               
   SUM FIELDS=NONE                                                   
   OUTREC IFTHEN=(WHEN=INIT,
                    OVERLAY=(711:SEQNUM,10,ZD)),               
                IFTHEN=(WHEN=(701,10,CH,EQ,C'9999999999'),                   
                 OVERLAY=(13:712,9,ZD,SUB,+2,TO=ZD,LENGTH=9))         
/*                   


Code:

IFTHEN=(WHEN=(5,8,CH,EQ,X'FFFFFFFFFFFFFFFF'),    --represents trailer


Code:

(13:712,9,ZD,SUB,+2,TO=ZD,LENGTH=9)) - represents the trailer count


Improvement or even a better and optimum solution is always welcome.

Please let me know if I am not clear.

Devil13
There is always a better solution
Back to top
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Fri Dec 17, 2010 4:34 pm
Reply with quote

devil13,

Your sort card and the one posted by the OP is exactly the same except for some field positions. I really have no clue on what you are trying to say.
Back to top
View user's profile Send private message
Guest







PostPosted: Fri Dec 17, 2010 4:43 pm
Reply with quote

Hi Arun,
I provided the sort card to OP initially and since you sugggested that:
Quote:

May be not. The sort card posted above may create different output during multiple runs for the same input data


So I wanted your opinion on the sort card and if it is wrong then we would definitely require your help in correcting it so that we could find the correct solution for the problem icon_smile.gif

Abish
There is always a better solution
Back to top
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Tue Dec 21, 2010 6:39 pm
Reply with quote

Your solution does NOT have the EQUALS parameter without which the order of records having equally keyed control fields can be unpredictable. You may not get the same output records for different runs with the same input
Quote:
There is always a correct solution
icon_lol.gif
Back to top
View user's profile Send private message
Guest







PostPosted: Fri Dec 24, 2010 2:37 pm
Reply with quote

Thanks Arun icon_smile.gif I will make the change.
Back to top
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 How to split large record length file... DFSORT/ICETOOL 10
No new posts To get the count of rows for every 1 ... DB2 3
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts Validating record count of a file is ... DFSORT/ICETOOL 13
Search our Forums:

Back to Top