Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Update trailer count through sort card

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Update trailer count through sort card
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: 2171
Location: @my desk

PostPosted: Thu Dec 16, 2010 11:48 am    Post subject:
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    Post subject: Reply to: Update trailer count through sort card
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: 2171
Location: @my desk

PostPosted: Fri Dec 17, 2010 11:07 am    Post subject:
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    Post subject: Reply to: Update trailer count through sort card
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: 2171
Location: @my desk

PostPosted: Fri Dec 17, 2010 11:35 am    Post subject:
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    Post subject: Reply to: Update trailer count through sort card
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10203
Location: italy

PostPosted: Fri Dec 17, 2010 12:54 pm    Post subject: Reply to: Update trailer count through sort card
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: 2171
Location: @my desk

PostPosted: Fri Dec 17, 2010 2:24 pm    Post subject:
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    Post subject:
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: 2171
Location: @my desk

PostPosted: Fri Dec 17, 2010 4:34 pm    Post subject:
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    Post subject:
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: 2171
Location: @my desk

PostPosted: Tue Dec 21, 2010 6:39 pm    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts -913/-911 Deadlock during UPDATE stat... NoSleep319 DB2 5 Fri Nov 18, 2016 12:37 am
No new posts How to update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm
No new posts Updating Cursor row withour using FOR... chandan.inst DB2 15 Tue Nov 08, 2016 11:17 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us