MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

DFSORT user exit - split a record

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
videlord
Beginner


Joined: 09 Dec 2004
Posts: 147
Topics: 19

PostPosted: Mon Apr 27, 2009 9:37 am    Post subject: DFSORT user exit - split a record Reply with quote

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.
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Mon Apr 27, 2009 10:36 am    Post subject: Reply with quote

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.

For complete details on DFSORT exits, see:

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CA30/4.0?DT=20080528171007
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
videlord
Beginner


Joined: 09 Dec 2004
Posts: 147
Topics: 19

PostPosted: Mon Apr 27, 2009 10:57 am    Post subject: Reply with quote

Thanks Frank.

Is there a sample assembler user exit routine for "user exit address constant"?
simple sample code for #4.7.2.3 in the manual would be perfect.
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Mon Apr 27, 2009 2:31 pm    Post subject: Reply with quote

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:

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CA30/4.9.1?SHELF=&DT=20080528171007&CASE=
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Mon Apr 27, 2009 6:23 pm    Post subject: Reply with quote

videlord,

If you are interested in a cobol exit you can try the following

Code:

//STEP0100 EXEC PGM=IGYCRCTL                   
//SYSPRINT DD SYSOUT=*                         
//SYSTERM  DD SYSOUT=*                         
//SYSUT1   DD UNIT=SYSDA,SPACE=(CYL,(10,2),RLSE)
//SYSUT2   DD UNIT=SYSDA,SPACE=(CYL,(10,2),RLSE)
//SYSUT3   DD UNIT=SYSDA,SPACE=(CYL,(10,2),RLSE)
//SYSUT4   DD UNIT=SYSDA,SPACE=(CYL,(10,2),RLSE)
//SYSUT5   DD UNIT=SYSDA,SPACE=(CYL,(10,2),RLSE)
//SYSUT6   DD UNIT=SYSDA,SPACE=(CYL,(10,2),RLSE)
//SYSUT7   DD UNIT=SYSDA,SPACE=(CYL,(10,2),RLSE)
//SYSLIN   DD DSN=&&LOADSET,                   
//            DISP=(MOD,PASS),                 
//            UNIT=SYSDA,                       
//            SPACE=(CYL,(1,1),RLSE)           
//SYSIN    DD *                                 
       IDENTIFICATION DIVISION.                             
       PROGRAM-ID.  E35SPLIT.                               
       DATA DIVISION.                                       
       WORKING-STORAGE SECTION.                             
       01  WS-SUB                 PIC S9(9) COMP VALUE 0.   
       01  WS-START-POS           PIC S9(9) COMP VALUE 0.   
                                                             
       LINKAGE SECTION.                                     
       01  LS-RECORD-FLAGS        PIC S9(8) COMP.           
       01  LS-DFSORT-RECORD.                                 
           05 LS-NUM-ENTRIES      PIC 9(4).                 
           05 LS-FLD-LENGTH       PIC 9(4).                 
           05 LS-FLD-REC          PIC X(72).                 
                                                             
       01  LS-RETURN-RECORD       PIC X(80).                 
                                                             
       PROCEDURE DIVISION USING LS-RECORD-FLAGS             
                                LS-DFSORT-RECORD             
                                LS-RETURN-RECORD.           
                                                             
                                                             
           IF LS-RECORD-FLAGS = 8                           
              MOVE 8               TO RETURN-CODE           
           ELSE                                             
              PERFORM 1000-MOVE-DATA                         
           END-IF                                           
           GOBACK                                           
           .                                                 
                                                             
       1000-MOVE-DATA.                                           
                                                                 
           COMPUTE WS-START-POS  = ( WS-SUB * LS-FLD-LENGTH ) + 1
           MOVE  LS-FLD-REC (WS-START-POS : LS-FLD-LENGTH)       
                                   TO LS-RETURN-RECORD           
           MOVE 12                 TO RETURN-CODE                 
           ADD +1                  TO WS-SUB                     
           IF WS-SUB >  LS-NUM-ENTRIES                           
              MOVE 4               TO RETURN-CODE                 
              MOVE 0               TO WS-SUB                     
                                      WS-START-POS               
           END-IF                                                 
           .                                                     
//STEP0200 EXEC PGM=IEWL,COND=(4,LT,STEP0100)                     
//SYSLIB   DD DSN=CEE.SCEELKED,                                   
//            DISP=SHR                                           
//SYSLIN   DD DSN=*.STEP0100.SYSLIN,DISP=(OLD,DELETE)             
//SYSLOUT  DD SYSOUT=*                                           
//SYSPRINT DD SYSOUT=*                                           
//SYSDBOUT DD SYSOUT=*                                           
//SYSUDUMP DD SYSOUT=*                                           
//SYSLMOD  DD DSN=your.pgm.Loadlib(E35SPLIT),                 
//            DISP=SHR                                           
//*                                                               
//STEP0300 EXEC PGM=SORT,COND=(4,LT,STEP0100)                     
//SYSOUT   DD SYSOUT=*                                           
//E35MSG   DD SYSOUT=*                                           
//EXITLIB  DD DISP=SHR,DSN=your.pgm.Loadlib
//SORTIN   DD *                                                   
00030004ABCD1234EFGH                                             
00040002EEEEFFFF                                                 
//SORTOUT  DD SYSOUT=*                                           
//SYSIN    DD *                                                   
  SORT FIELDS=COPY                                               
  MODS E35=(E35SPLIT,80,EXITLIB,C)                               
  OPTION COBEXIT=COB2,MSGDDN=E35MSG 
//*


The output from this job is

Code:

ABCD
1234
EFGH
EE   
EE   
FF   
FF   

_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
videlord
Beginner


Joined: 09 Dec 2004
Posts: 147
Topics: 19

PostPosted: Mon Apr 27, 2009 9:21 pm    Post subject: Reply with quote

Thanks Frank and Kolusu, I'll try it.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
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


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group