IBM AS/400 manual Sample Service Program, Part 1 of 2. Source for Service Program CvtToHex

Models: AS/400

1 489
Download 489 pages 47.95 Kb
Page 119
Image 119
Figure 42 (Part 1 of 2). Source for Service Program CvtToHex

Sample Service Program

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

*CvtToHex - convert input string to hex output string *=================================================================*

H COPYRIGHT('(C) Copyright MyCompany 1995')

D/COPY RPGGUIDE/QRPGLE,CVTHEXPR

 

 

 

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

 

 

*

 

* Main entry parameters

 

 

 

 

* 1. Input:

string

 

 

character(n)

 

* 2. Output:

hex string

 

 

character(2 * n)

 

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

 

 

*

D CvtToHex

PI

 

 

OPDESC

D

InString

 

16383

 

CONST OPTIONS(*VARSIZE)

D

HexString

 

32766

 

OPTIONS(*VARSIZE)

 

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

 

 

*

 

* Prototype for CEEDOD (Retrieve operational descriptor)

 

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

 

 

*

D CEEDOD

PR

 

 

 

D ParmNum

 

10I

0

CONST

D

 

 

10I

0

 

D

 

 

10I

0

 

D

 

 

10I

0

 

D

 

 

10I

0

 

D

 

 

10I

0

 

D

 

 

12A

 

OPTIONS(*OMIT)

 

* Parameters passed to CEEDOD

 

 

D DescType

S

10I

0

 

D DataType

S

10I

0

 

D DescInfo1

S

10I

0

 

D DescInfo2

S

10I

0

 

D InLen

S

10I

0

 

D HexLen

S

10I

0

 

 

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

 

 

*

 

* Other fields used by the program

 

*

 

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

 

 

*

D HexDigits

C

 

 

CONST('0123456789ABCDEF')

D IntDs

DS

 

 

 

D

IntNum

 

5I

0

INZ(0)

D

IntChar

 

1

 

OVERLAY(IntNum:2)

D HexDs

DS

 

 

 

D

HexC1

 

1

 

 

D

HexC2

 

1

 

 

D InChar

S

1

 

 

D Pos

S

5P

0

 

D HexPos

S

5P

0

 

Figure 42 (Part 1 of 2). Source for Service Program CvtToHex

Chapter 8. Creating a Service Program95

Page 119
Image 119
IBM AS/400 manual Sample Service Program, Part 1 of 2. Source for Service Program CvtToHex, Creating a Service Program95