IBM AS/400 manual Sample Service Program, Program to test Service Program CVTTOHEX

Models: AS/400

1 489
Download 489 pages 47.95 Kb
Page 123
Image 123
* Program to test Service Program CVTTOHEX

Sample Service Program

*

----------------------------------------------------------------

 

 

 

*

* Program to test Service Program CVTTOHEX

*

*

 

 

 

 

 

*

* 1. Use a 7-character input string

*

* 2. Convert to a 10-character hex string (only the first five￿

*

*

input characters will be used because the result is too

*

*

small for the entire input string)

*

* 3. Convert to a 14-character hex string (all seven input

*

*

characters will be used because the result is long enough￿)

*

*

----------------------------------------------------------------

 

 

 

*

FQSYSPRT

O

F

80

PRINTER

 

*Prototype for CvtToHex

D/COPY RPGGUIDE/QRPGLE,CVTHEXPR

D ResultDS

DS

 

 

 

D

Result14

1

14

 

 

D

Result10

1

10

 

 

D InString

S

7

 

 

D Comment

S

25

 

 

C

 

 

EVAL

InString = 'ABC123*'

 

 

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

 

 

 

*

 

* Pass character string and the 10-character result field

*

 

* using a prototyped call.

Operational descriptors are

*

 

* passed, as required by the called procedure CvtToHex.

*

 

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

 

 

 

*

C

 

 

EVAL

Comment = '10 character output'

 

C

 

 

CLEAR

 

ResultDS

 

C

 

 

CALLP

CvtToHex(Instring : Result10)

 

C

 

 

EXCEPT

 

 

 

 

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

 

 

 

*

 

* Pass character string and the 14-character result field

*

 

* using a CALLB(D). The operation extender (D) will create

*

 

* operational descriptors for the passed parameters. CALLB

*

 

* is used here for comparison with the above CALLP.

*

 

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

 

 

 

*

C

 

 

EVAL

Comment = '14 character output'

 

C

 

 

CLEAR

 

ResultDS

 

C

 

 

CALLB(D)

'CVTTOHEX'

 

 

C

 

 

PARM

 

InString

 

C

 

 

PARM

 

Result14

 

C

 

 

EXCEPT

 

 

 

C

 

 

EVAL

*INLR = *ON

 

 

OQSYSPRT

H

1P

 

 

 

O

 

 

 

 

'Result14++++++'

 

OQSYSPRT

H

1P

 

 

 

O

 

 

 

 

'Result10++'

 

OQSYSPRT

E

 

 

 

 

O

 

 

ResultDS

 

 

O

 

 

Comment

+5

 

 

 

 

 

 

Figure

45.

Source for Test Program CVTHEXPGM

 

 

Chapter 8. Creating a Service Program99

Page 123
Image 123
IBM AS/400 manual Sample Service Program, Program to test Service Program CVTTOHEX