Page 1 of 1
Field inside Field
Posted:
Thu Jul 25, 2013 3:00 am
by sriraj1122
I have a scenario as below.
10 VARIABLE1 PIC X(10)
10 FIELD1 PIC 9(10)
Variable1 = "Field1"
FIELD1 = 1234
In the program I can access only Variable1 but should be able to move 1234 in to another variable using VARIABLE1.
Re: Field inside Field
Posted:
Thu Jul 25, 2013 3:31 am
by prino
In your dreams!
It's obvious that you completely and utterly mistakenly believe that COBOL, as a compiled language, has the same capabilities as REXX...
Re: Field inside Field
Posted:
Thu Jul 25, 2013 4:47 am
by Robert Sample
Sorry, but COBOL does not work that way. You cannot use a variable to define at run-time where to move a value.
Re: Field inside Field
Posted:
Thu Jul 25, 2013 5:25 pm
by c62ap90
I'm not exactly sure what you are trying to do.
Are you trying to use the same area for alphanumeric (pic x) and numeric (pic 9) data?
10 VARIABLE1 PIC X(10).
10 FIELD1 REDEFINES VARIABLE1
PIC 9(10).
MOVE 'Field1' TO VARIABLE1.
MOVE 1234 TO FIELD1.
MOVE '1234' TO VARIABLE1.
Re: Field inside Field
Posted:
Thu Jul 25, 2013 9:19 pm
by Robert Sample
c62ap90, the original question had nothing to do with REDEFINES. The original question was about how to use indirect references in COBOL. And COBOL does not support indirect references.