PMS Information Systems
Welcome to PMS Information Systems - IBM i (AS/400) Forum !!!

Get Answers for all your queries on IBM i (AS/400).

Join the forum, it's quick and easy

PMS Information Systems
Welcome to PMS Information Systems - IBM i (AS/400) Forum !!!

Get Answers for all your queries on IBM i (AS/400).
PMS Information Systems
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Decimal data error – Scenario 1

Go down

data - Decimal data error – Scenario 1 Empty Decimal data error – Scenario 1

Post  maran Sat Jun 04, 2016 10:25 pm

Decimal data error – Scenario 1

One of the downside of IBM i OS is that when the program is called by SBMJOB, it given a decimal data error. If you call interactively this decimal data error will not occur. Let us assume CL pass a numeric variable ( decimal)  as a parameter to RPG program.

If you call directly (interactively) for example

DCL VAR(&INVNO) TYPE(*DEC) LEN(5 0)
CALL  PGM(INVPRINT)  PARM(&INVNO)

Above call command will not give decimal data error.

But you submit as follows
SBMJOB      CMD(CALL  PGM(INVPRINT)  PARM(&INVNO))  JOB(INVPRINT)  JOBD(INVJOBD)

The above command causes a decimal data error.

How to get rid of it?
We can overlay decimal variable with character variable  as follows:

DCL  VAR(&INVNO1)   TYPE(*CHAR)   LEN(3)  STG(*DEFINED)  DEFVAR(&INVNO)
&INVNO is packed decimal WITH LENGTH 5, which occupies 3 bytes, so &INVNO1 is defined as a 3 byte character variable that overlays &INVNO
Now we can use this char variable & INVNO1 to call INVPRINT program instead of &INVNO as follows:

SBMJOB      CMD(CALL  PGM(INVPRINT)  PARM(&INVNO1))  JOB(INVPRINT)  JOBD(INVJOBD)
maran
maran
Admin

Posts : 442
Join date : 2009-07-24

https://pmsinformationsystem.forumotion.net

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum