IBM AS/400 Frozen Dessert Maker User Manual


 
Passing Prototyped Parameters
2. Correct the street number for printing using the subroutine GetStreet#.
3. Concatenate the complete address.
4. Return.
*=================================================================*
* FMTADDR - format an address
*
* Interface parameters
* 1. Address character(70)
* 2. Street number packed(5,0)
* 3. Street name character(20)
* 4. City character(15) (some callers do not pass)
* 5. Province character(15) (some callers do not pass)
*=================================================================*
* Pull in the prototype from the /COPY member
/COPY FMTADDRP
DFmtAddr PI
D Address 70
D Street# 5 0 CONST
D Street 20 CONST
D P_City 15 OPTIONS(*NOPASS) CONST
D P_Province 15 OPTIONS(*NOPASS) CONST
*-----------------------------------------------------------------*
* Default values for parameters that might not be passed.
*-----------------------------------------------------------------*
D City S 15 INZ('Toronto')
D Province S 15 INZ('Ontario')
*-----------------------------------------------------------------*
* Check whether the province parameter was passed. If it was,
* replace the default with the parameter value.
*-----------------------------------------------------------------*
C IF %PARMS > 4
C EVAL Province = P_Province
C ENDIF
*-----------------------------------------------------------------*
* Check whether the city parameter was passed. If it was, *
* replace the default with the parameter value. *
*-----------------------------------------------------------------*
C IF %PARMS > 3
C EVAL City = P_City
C ENDIF
*-----------------------------------------------------------------*
* Set 'CStreet#' to be character form of 'Street#' *
*-----------------------------------------------------------------*
C EXSR GetStreet#
*-----------------------------------------------------------------*
* Format the address as Number Street, City, Province *
*-----------------------------------------------------------------*
C EVAL ADDRESS = %TRIMR(CSTREET#) + ' ' +
C %TRIMR(CITY) + ' ,' +
C %TRIMR(PROVINCE)
C RETURN
Figure 68 (Part 1 of 2). Source for procedure FMTADDR
142 ILE RPG for AS/400 Programmer's Guide