AS/400 RPG, Passing an Integer variable to an RPG program from the command line

10 pts.
Tags:
AS/400
Command line
Integer variable
RPG ILE
How can you pass an Integer variable to an RPG program from the command line? Please provide an example.

Software/Hardware used:
AS/400, RPG ILE
ASKED: August 28, 2013  7:18 PM
UPDATED: August 30, 2013  9:19 PM

Answer Wiki

Thanks. We'll let you know when a new response is added.

Use Hexidecmals

Call Pgm Parm(x’001F’ x’00010F’)

The first parm is a 3 position numberic field, value of 1

The second parm is a 4 position numberic field, value of 10

Inside the ticks after the X must be a even number of positions including the F.  Therefor the 4 position numberic field has an extra zero in front of the number to make it a even number of positions.  F is for a positive number, I don’t remember what is used for a negative number.

************************

As Tom mentioned, we really need to see the RPG data definition for the “integer variable” to accurately answer your question. The earlier answer (x’001F’ x’00010F’) is correct if what you’re after is packed decimal numeric data to be passed as parameters. If, on the other hand, you want 4-byte integer data values passed then you would use x’00000001′ and x’0000000A’ to pass the numeric values 1 and 10 respectively.

Not really enough information in your question to know what your actual question is…

Bruce Vining

Discuss This Question: 2  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • philpl1jb

    To test an RPG program, I make a small rpg program to populate the parameters and call it passing the necessary parmeters. 

    48,575 pointsBadges:
    report
  • TomLiotta

    We need to know the data definition specs to be certain. However, if a small RPG program can be used to pass test values, it can use the exact definition from your target program.

    But if this will be a permanent solution, the best way is to create a *CMD definition that will format the value as needed from a command line.

    Tom

    125,585 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following