Say you want to define a user-written HLL function called Get customer credit limit into another CA 2E standard function. The EXCUSRSRC function has three parameters:
|
IOB |
Parameter |
GEN Name |
|---|---|---|
|
I |
Customer code |
CUCD |
|
I |
Trial value |
TRQT |
|
O |
Trial limit |
TRLM |
To specify this function you might do the following:
Refer to the following examples of RPG and COBOL and then proceed to Step 6.
The following example shows RPG EXCUSRSRC.
** Get customer credit limit ) <- IGNORED ** Company : Universal Sprocket Co ) ** System : Widget processing system ) ** Author : YOU ) FUUCUCRLOIF E K DISK ) <- OTHER SPECIFICATIONS * Customer credit limits ) * Set up parameters ) <- INSTANCE CODE C MOVE #ICUCD UACUNB ) C Z-ADD#ITRQT UATRQT ) C EXSR UACRLM ) C Z-ADDUACRLM #OTRLM ) CSR UACRLM BEGSR ) <- SUBROUTINE *================================================ )============================= * Get credit limit ) *================================================ )============================= C MOVEA*IN,60 UWIN 1 ) *Save * Set of record error indicators. ) C UACUNB CHAIN @ CUCRQQ 60 ) C *IN60 IFEQ '0' ) C UATRQT ADD QQCRLM UACRLM ) C END ) C _ MOVEA UWIN *IN,60 ) *Restore *================================================ )============================= CSR UAEXIT ENDSR ) * Initialization for credit test ) *================================================ )============================= C Z-ADD*ZERO UACRLM ) <- ZZINIT code *================================================ )=============================
The following example shows COBOL EXCUSRSRC.
+++++ -A 1 B .. ... 2 ... ... 3 ** Get customer credit limit ) <- IGNORED ** Company : Universal Sprocket Co ) ** System : Widget processing system ) ** Author : FRED ) INPUT-OUTPUT SECTION. ) <- OTHER FILE-CONTROL. ) SPECIFICATIONS SELECT UUCUCRL0 ) ASSIGN TO DATABASE-CBABREL1 ) ORGANIZATION IS INDEXED ) ACCESS MODE IS DYNAMIC ) RECORD KEY IS EXTERNALLY-DESCRIBED-KEY ) FILE STATUS is FILE-STATUS. ) * Customer credit limits ) FILE-SECTION. ) FD UUCUCRL0 ) LABEL RECORDS ARE STANDARD. ) 01 UUCUCRL0-F. COPY DDS-ALL-FORMATS OF UUCUCRL0. WORKING-STORAGE SECTION. ) <- NEW VARIABLES 01 UWIN PIC X. ) PROCEDURE-DIVISION. ) <- INSTANCE CODE * Set up parameters ) MOVE USR-PARM-I-CUCD TO UACUNB OF YCUCRQQ ) MOVE USR-PARM-I-TRQT TO UATRQT OF YCUCRQQ ) PERFORM UACRLM ) MOVE UACRLM OF YCUCRQQ TO USR-PARM-O-TRLM ) * Get credit limit ) <- SUBROUTINE UACRLM SECTION. ) MOVE IND(60) TO UWIN ) * Set of record error indicators. ) READ UUCUCRL0 ) FORMAT IS ‘YCUCRQQ’ ) END-READ ) IF C-NO-RECORD ) MOVE C-IND-ON TO IND(60) ) ELSE ) MOVE C-IND-OFF TO IND(60) ) END-IF ) IF IND(60) = C-IND-ON ) ADD UATRQT OF YCUCRQQ, QQCRLM ) GIVING UACRLM OF YCUCRQQ ) END-ADD ) END-IF )
> USER: User defined action
: -
: Get customer credit limit * < < <
'-
Supply the required parameters for the action using the Edit Action Details panel. For example:

The following table shows an example of the code generated for the call. These are the names of the values passed to the parameters.
|
IOB |
Parameter |
GEN Name |
Variable |
GEN Name |
|---|---|---|---|---|
|
I |
Customer code |
CUCD |
Customer code |
CUCD |
|
I |
Trial value |
TRQT |
Order value |
ORQT |
|
O |
Trial limit |
TRLM |
Customer credit limit |
CULM |
CA 2E generates the following RPG and COBOL code for the particular call:
UAEXIT. ) EXIT. ) * ZZINIT code. USR-INIT SECTION. ) < - ZZINIT CODE MOVE ZEROES TO UACRLM OF YCUCRQQ )
The following example shows EXCUSRSRC - RPG call.
* Get customer credit details * Set up parameters C MOVE # 1CUCD UACUNB C Z-ADD #2ORQT UATRQT C EXSR UACRLM C Z-ADDUACRLM #1CULM
The following example shows EXCUSRSRC - COBOL Call.
+++ -A 1 B.. ... 2 ... ... 3 * Get customer credit details * Set up parameters MOVE Z1CUCD OF ZSFLRCD-WS-O TO UACUNB OF YCUCRQQ MOVE Z2ORQT OF ZSFLCTL-WS-O TO UATRQT OF YCUCRQQ PERFORM UACRLM MOVE UACULM OF YCUCRQQ TO Z1CULM OF ZSFLRCD-WS-O
CA 2E includes the other source code statements for the EXCUSRSRC function into the source of the calling function without modification.
| Copyright © 2011 CA. All rights reserved. | Tell Technical Publications how we can improve this information |