MAPPUT

This MAPPUT command makes a request to pack or concatenate variables from a specified Data Mapping, defined by the MAPDEF command, into a single variable.

Format

Read syntax diagramSkip visual syntax diagramMAPPUTmapnamebuffer
Call Name DB/DC DBCTL DCCTL DB Batch TM Batch
MAPPUT X X X X X

Usage

The mapname variable name specifies the data mapping to use, a 1- to 16-character case-independent name. The buffer variable name is the REXX variable that will contain the resulting value.

Map names can also be specified in the REXXTDLI call in place of variable names to be fetched or read. This step is called an implicit MAPPUT and lets you avoid the explicit MAPPUT call. To indicate that a Map name is being passed in the DL/I call, precede the name with an asterisk (*), for example, 'ISRT IOPCB *OUTMAP'.

Note: If the data mapping is only partial and some fields in the record are not mapped to REXX variables, then the first field in the mapping should be a character type of length asterisk (*), as shown in the following code example. This step is the only way to ensure that non-mapped (skipped) fields are not lost between the MAPGET and MAPPUT calls, whether they be explicit or implicit.
This example uses explicit support.
Address REXXTDLI
'GHU DBPCB SegVar SSA1'                 /* Read segment              */
If RC¬=0 Then Signal BadCall            /* Check for failure         */
Address REXXIMS 'MAPGET DBMAP SegVar'   /* Decode Segment            */
DBM_Total = DBM_Total + Deposit_Amount  /* Adjust Mapped Variable    */
Address REXXIMS 'MAPPUT DBMAP SegVar'   /* Encode Segment            */
'REPL DBPCB SegVar'                     /* Update Database           */
If RC¬=0 Then Signal BadCall            /* Check for failure         */
This example uses implicit support.
Address REXXTDLI
'GHU DBPCB *DBMAP SSA1'                 /* Read and decode segment if read */
If RC¬=0 Then Signal BadCall            /* Check for failure               */
DBM_Total = DBM_Total + Deposit_Amount  /* Adjust Mapped Variable          */
'REPL DBPCB *DBMAP'                     /* Update Database                 */
If RC¬=0 Then Signal BadCall            /* Check for failure               */
If an error occurs during a MAPPUT, such as a Map field defined larger than the variable's contents, then the field is truncated. If the variable's contents are shorter than the field, the variable is padded:
Character (C)
Padded on right with blanks
Character (V)
Padded on right with zeros
Numeric (B,Z,P)
Padded on the left with zeros

If a MAP variable does not exist when a MAPPUT is processed, the variable and its position are skipped. All undefined and skipped fields default to binary zeros. A null parameter is parsed normally. Conversion of non-numeric or null fields to numeric field results in a value of 0 being used and no error.