Posted: Mon Apr 27, 2009 9:37 am Post subject: DFSORT user exit - split a record
I want to code a user exit to split one record to several records,
input
xxxxyyyy-------------------
xxxx - number of new records
yyyy - length of new records
e.g.
00030004ABCD1234EFGH
will be converted to 3 records with length 4
ABCD
1234
EFGH
can xxxx yyyy be stored in a variable and pass to next invoking? or any other option? Thanks.
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Mon Apr 27, 2009 10:36 am Post subject:
Your DFSORT user exit (E15 or E35) can OBTAIN an area of storage the first time it is called and save a pointer to that area in the "user exit address constant" word in the exit parameter list. The "user exit address constant" will then be passed in the exit parameter list each time your exit is called. So the exit can use that area of storage as a communication area for storing and retrieving variables.
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Mon Apr 27, 2009 2:31 pm Post subject:
Your E15 would just need to do an OBTAIN (or GETMAIN) on the first call and save the address of the area obtained in the second word of the two word E15 parameter list. Then on subsequent calls to the E15, that second word of the parameter list would contain the pointer to your area.
Note: If you're not concerned about reentrancy or passing the area between an E15 and an E35, you could just use "static" areas in your E15 to hold your vairables. Like the NEWRDW and DATA areas in the example at:
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum