IBM AS/400 manual Passing Prototyped Parameters, Part 2 of 2. Source for procedure FMTADDR

Models: AS/400

1 489
Download 489 pages 47.95 Kb
Page 167
Image 167
Figure 68 (Part 2 of 2). Source for procedure FMTADDR

Passing Prototyped Parameters

 

*=================================================================*

 

* SUBROUTINE: GetStreet#

 

 

 

 

 

* Get the character form of the street number, left-adjuste￿d

*

 

* and padded on the right with blanks.

 

 

*

 

*=================================================================*

C

GetStreet#

BEGSR

 

 

 

 

C

 

MOVEL

Street#

CStreet#

10

 

 

*-----------------------------------------------------------------

 

 

 

*

 

* Find the first non-zero.

 

 

 

*

 

*-----------------------------------------------------------------

 

 

 

*

C

'0'

CHECK

CStreet#

Non0

5 0

 

 

*-----------------------------------------------------------------

 

 

 

*

 

* If there was a non-zero, substring the number starting at

 

*

 

* non-zero.

 

 

 

 

*

 

*-----------------------------------------------------------------

 

 

 

*

C

 

IF

Non0 > 0

 

 

 

C

 

SUBST(P)

CStreet#:Non0 CStreet#

 

 

 

*-----------------------------------------------------------------

 

 

 

*

 

* If there was no non-zero, just use '0' as the street number.

*

 

*-----------------------------------------------------------------

 

 

 

*

C

 

ELSE

 

 

 

 

C

 

MOVEL(P)

'0'

CStreet#

 

 

C

 

ENDIF

 

 

 

 

C

 

ENDSR

 

 

 

 

Figure 68 (Part 2 of 2). Source for procedure FMTADDR

*=================================================================*

*Prototype for FMTADDR - format an address *=================================================================*

DFmtAddr

PR

 

D

addr

70

 

D

strno

5

0 CONST

D

st

20

CONST

D

cty

15

OPTIONS(*NOPASS) CONST

D

prov

15

OPTIONS(*NOPASS) CONST

 

 

Figure

69. Source for /COPY member with Prototype for Procedure FMTADDR

Figure 70 on page 144 shows the source for the procedure PRTADDR. Th cedure serves to illustrate the use of FMTADDR. For convenience, the dures which would each call FMTADDR are combined into this single proc Also, for the purposes of the example, the data is program-describe

Since PRTADDR is'three procedures-'in,-oneit must define three different address data structures. Similarly, there are three parts in the c tions, each one corresponding to programs at each stage. After printi address, the procedure PRTADDR ends.

Chapter 10. Calling Programs and Procedures143

Page 167
Image 167
IBM AS/400 manual Passing Prototyped Parameters, Part 2 of 2. Source for procedure FMTADDR