Unable to use 9 digit field in RPG

40 pts.
AS 400
I am using one PF file in RPG program, The file field is 9 digit. I can't able to use the field in RPG program. Any suggestion?

Answer Wiki

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

You must be using a QRPGSRC source file and not a QRPGLESRC file. 

The QRPGLESRC will allow a factor 2 name of up to something like this.
c                   move      field678901456result

You can have a name up to 16 characters in length

Discuss This Question: 5  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.
  • TheRealRaven
    Lots of suggestions, but we need to know what the problem is first.

    Why can't you use it? What happens when you try? Is there an error message? (What is it?) What is the field definition in the PF? What is the RPG code that tries to use the field?
    37,045 pointsBadges:
  • Santhzh12
    I am performing MOVE operation in RPG:
     Operation      Factor 2     Result 
       MOVE         TEST123456   TEST   

    Factore 2 is allowed when i use 6 digit field name. If i use 10 digit field name. Program showing Factor 2 invalid .
    40 pointsBadges:
  • ToddN2000
    How are the factor 2 and result filed defined? Usually a move is used for alphanumeric to alphanumeric fields. Old school coders used the move of numeric into alpha but that was yeas ago.
    Today's BIF's can handle a lot more data manipulation and conversion.

    We need to understand what filed types and lengths you are working with to point you in a better direction.
    136,530 pointsBadges:
  • Santhzh12
    Please find the details: Below is the statement i try to perform 

    Operation      Factor 2     Result 
       MOVE         TEST123456   TEST   

    Field: TEST123456 is the File field data type is Alphanumeric and length is 2.

    Field: TEST is program defined variable, data type is Alphanumeric and length is 2.

    Issue here: Not at run time or compile time. At the development time. If i key in the Factor2 of Move command with Field name of 10 digit, RPG is not allowing. If i use Factor2 with field name of 6 digit only. I want to use 10 digit field name. 
    40 pointsBadges:
  • RossHowatson
    You may be using an RPG source member and not an RPGLE source member.

    You are using RPG in a fix format and not free form format therefore you need to look at field lengths on the statement.  

    Since you are using fixed number that is greater than the length of the field name/value field length it does not use the full length and errors out because the result field now begins with a number and not a alphabetic character.

    A quick solution is to convert this section from Fixed Format RPG to free format RPG and use the Evaluate statement (and converting the source code to RPGLE is initially as simple as changing the TYPE field from RPG to RPGLE.

    If you cannot change the member type then you can move the first five digits (12345 of 123456789) to the field (Z-ADD 12345     RESULT1) then multiply the field by 10000 (10000  MULTI RESULT1   RESULT1) and then add 6789 to the RESULT1 field (RESULT1  ADD 6789   RESULT1).

    You can prompt for the correct syntax layout and keyword when you are working in RPG or RPGLE by pressing the command 4 key within either PDM or Rational Developer for i.

    If you can only read the field but not insert into or update the field in question then look at how the file was created.  If the file was created with DDS it may have the field defined as Output only (this would be extremely unusual for a physical file to have a field defined as output only)!  This field exists for screen and printer output to be defined as output only on the display or printer.
    630 pointsBadges:

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.

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


Share this item with your network: