View previous topic :: View next topic
|
Author |
Message |
Vasusha
New User
Joined: 30 Jun 2006 Posts: 2
|
|
|
|
What could be the impact of the following code :
01 SHORTLIST-TABLE-DATA.
05 FILLER PIC X(28971) VALUE ALL '0'.
01 FILLER REDEFINES SHORTLIST-TABLE-DATA.
05 SHORTLIST-TABLE OCCURS 999 TIMES
INDEXED BY TBL-IDX.
10 TBL-CUST-NO PIC 9(11).
10 TBL-CUST-ORG PIC 9(3).
10 TBL-CUST-NBR PIC X(19).
It got compiled without any errors |
|
Back to top |
|
|
guptae
Moderator
Joined: 14 Oct 2005 Posts: 1208 Location: Bangalore,India
|
|
|
|
I think in SHORTLIST-TABLE after 28971 bytes it will contain some junk data.
since it is defining smaller variable of 28971 bytes.
Correction r welcome. |
|
Back to top |
|
|
Vasusha
New User
Joined: 30 Jun 2006 Posts: 2
|
|
|
|
Actually the code was present in a production program, I was wondering if it really gives correct results. I coded a test program and it showed the output correctly.
IDENTIFICATION DIVISION.
PROGRAM-ID. GCBP01.
AUTHOR. VASUDEVA
DATE-WRITTEN. SEP, 2006.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
*
DATA DIVISION.
FILE SECTION.
*
*
WORKING-STORAGE SECTION.
*
01 SHORTLIST-TABLE-DATA PIC X(10).
*
01 FILLER REDEFINES SHORTLIST-TABLE-DATA.
05 SHORTLIST-TABLE OCCURS 10 TIMES
INDEXED BY TBL-IDX.
10 TBL-NAME PIC X(05).
*
PROCEDURE DIVISION.
*=============================================================*
* MAIN PROGRAM
*=============================================================*
0000-MAIN.
MOVE "VASU1" TO TBL-NAME(1).
MOVE "VASU2" TO TBL-NAME(2).
MOVE "VASU3" TO TBL-NAME(3).
MOVE "VASU4" TO TBL-NAME(4).
MOVE "VASU5" TO TBL-NAME(5).
DISPLAY 'FIRST NAME IS ' TBL-NAME(1)
DISPLAY 'FIRST NAME IS ' TBL-NAME(2)
DISPLAY 'FIRST NAME IS ' TBL-NAME(3)
DISPLAY 'FIRST NAME IS ' TBL-NAME(4)
DISPLAY 'FIRST NAME IS ' TBL-NAME(5).
STOP RUN.
*
Following was the output
FIRST NAME IS VASU1
FIRST NAME IS VASU2
FIRST NAME IS VASU3
FIRST NAME IS VASU4
FIRST NAME IS VASU5
Can I confirm with this that the code in production is working fine or is it that the results may vary basing on some compile options or compiler versions |
|
Back to top |
|
|
guptae
Moderator
Joined: 14 Oct 2005 Posts: 1208 Location: Bangalore,India
|
|
|
|
Hi Vasusha,
Code is fine.
It will work definately since you are moving values to TBL-NAME & then displaying it.
And SHORTLIST-TABLE-DATA will contain VASU1VASU2.
Hope I am clear enough |
|
Back to top |
|
|
HARIBHARAT
New User
Joined: 05 Jul 2006 Posts: 65 Location: pune
|
|
|
|
Still I have doubt u r declare Index TBL_idx , TBL_Nmae subscript.
we can use same thing single program, what is the use index variable,
Regards
suresh |
|
Back to top |
|
|
|