Previous Topic: Macros for Output ModulesNext Topic: Generating Edit and Code Tables


Sample Output Module

The following sample edit module transposes a 6-digit date from yymmdd to mmddyy format. The #MOPT macro included in this sample module generates register equates for use in coding the module, sets up a CSECT name for the module, and includes the name of the macro and its date/time stamp in future listings of the module. Use of the #MOPT macro is optional.

Edit modules can be either SYSTEM or USER MODE programs; the majority are USER MODE. To specify a user-written edit module mode, use the #MOPT macro. Set the ENV parameter to USER for the USER MODE program or to SYS or SYSTEM for SYSTEM MODE. If you do not set the ENV parameter, the defaults imply that it is set to USER.

If a DC request is issued, USER MODE programs need to be link edited with IDMSBALI or need to issue a #BALI macro within the user-written edit module. If a DC request is not issued in the program, there is no need to link edit the program with IDMSBALI or to issue a #BALI macro within the code.

You don't need to link edit SYSTEM MODE edit modules with IDMSBALI or have the program contact the #BALI macro. However, the CSA DSECT must be copied into your code if you issue any DC request. If you issue a DC request, R9 and R10 must point to the TCE and CSA at the time of the request.

Note: It is recommended that this module be performed before automaticediting so that an external picture can be used to insert slashes (/) into the date to make it mm/dd/yy.

         COPY  #CSADS                                                   00000100
         COPY  #MRBDS                                                   00000200
         #MOPT CSECT=CSYPDTE2,ENV=SYS                                   00000300
DTE2NTRY #START MPMODE=ANY                                              00000400
**********************************************************************  00000500
*  R1 POINTS TO A SIX WORD PARAMETER LIST FOR MAPOUT AS FOLLOWS:     *  00000600
*                                                                    *  00000700
*  WORD1   0(R1) ───► ADDRESS OF DATA IN USER'S RECORD BUFFER        *  00000800
*  WORD2   4(R1) ───► ADDRESS OF NEXT POSITION IN OUTPUT BUFFER      *  00000900
*  WORD3   8(R1) ───► ADDRESS OF MRE                                 *  00001000
*  WORD4  12(R1) ───► ADDRESS OF MCE                                 *  00001100
*  WORD5  16(R1) ───► ADDRESS OF PTE                                 *  00001200
*  WORD6  20(R1) ───► ADDRESS OF MRB                                 *  00001300
**********************************************************************  00001400
         L     R2,0(R1)              GET ADDRESS OF DATA FIELD          00001500
         L     R3,4(R1)              GET ADDRESS OF NEXT OUTBUF POS     00001600
         L     R4,8(R1)              GET ADDRESS OF MRE                 00001700
         USING MRE,R4                                                   00001800
         USING CSA,R10                                                  00001900
         #TEST MRETERR,OFF=FLIPDATE  ARE WE IN AN ERROR CYCLE ?         00002000
         MVC   0(6,R3),=C'?00000'    MOVE ERROR FIELD TO BUFFER         00002100
         B     RETURN                                                   00002200
FLIPDATE MVC   0(2,R3),2(R2)         MOVE MONTH                         00002300
         MVC   2(2,R3),4(R2)         MOVE DAY                           00002400
         MVC   4(2,R3),0(R2)         MOVE YEAR                          00002500
         MVC   0(6,R2),0(R3)         MOVE REVERSED FIELD INTO BUFFER    00002600
RETURN   LA    R1,6(R3)              INCREMENT USER BUFFER POINTER      00002700
         #RTN                                                           00002800
         END   DTE2NTRY                                                 00002900