MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

COBOL II table define and use
Goto page 1, 2  Next
 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
shiv_swami
Beginner


Joined: 29 Nov 2003
Posts: 68
Topics: 14

PostPosted: Tue Aug 29, 2006 2:22 pm    Post subject: COBOL II table define and use Reply with quote

Hello All,

One of my colleagues is facing problem with following structure.

The program is IDMS- COBOLII type.
Code:


01  WS-TABLE3.                                                 
    05 WS-BANK-106-TABLE OCCURS 120 TIMES DEPENDING ON WS-H106 
                                    INDEXED BY WS-IX106.       
       10 WS-BANK-106-DBKEY     PIC S9(08) COMP.               
       10 WS-BANK-106-AMT       PIC S9(13)V9(02) COMP.         
       10 WS-BANK-106-AMT-ORIG  PIC S9(13)V9(02) COMP.         
       10 WS-BANK-106-DUEDT     PIC  9(08).                     
       10 WS-BANK-106-PURGE     PIC  X(01).                     

01  WS-TABLE4.                                                   
    05 WS-BANK-126-TABLE OCCURS 120 TIMES DEPENDING ON WS-H126   
                                    INDEXED BY WS-IX126.         
       10 WS-BANK-126-DBKEY     PIC S9(08) COMP.                 
       10 WS-BANK-126-AMT       PIC S9(13)V9(02) COMP.           
       10 WS-BANK-126-AMT-ORIG  PIC S9(13)V9(02) COMP.           
       10 WS-BANK-126-DUEDT     PIC  9(08).                     
       10 WS-BANK-126-PURGE     PIC  X(01).                     
                 
MOVE +0   TO WS-O106   
             WS-O126   
             WS-H106   
             WS-H126.

**** Some logic to retrieve amounts and the values at this point are
********  WS-H106 = 2 and WS-H126 = 0
    COMPUTE WS-AMT-106-HI-BAL ROUNDED                       
            = WS-AMT-106-HI-BAL * WS-AMT-FACTOR.           
    COMPUTE WS-AMT-126-HI-BAL ROUNDED                       
            = WS-AMT-126-HI-BAL * WS-AMT-FACTOR.           
                                                           
    MOVE WS-AMT-106-HI-BAL TO WS-BANK-106-AMT(WS-H106).     
    MOVE WS-AMT-126-HI-BAL TO WS-BANK-126-AMT(WS-H126).     
    ADD  WS-AMT-106-HI-BAL TO WS-BANK-106-AMT-TXN.         
    ADD  WS-AMT-126-HI-BAL TO WS-BANK-126-AMT-TXN.                                                                     
                                                           
    WS-H106               PIC 9(03) COMP VALUE 0.   
    WS-H126               PIC 9(03) COMP VALUE 0.


My fellow colleague has not used index WS-IX126 to refer to the fields in table structure.
Is it correct to use WS-H126 (more like index/subscript) to refer to field in table?

Thank you for your help
_________________
Regards,
Shivprakash
Back to top
View user's profile Send private message Yahoo Messenger
shekar123
Advanced


Joined: 22 Jul 2005
Posts: 528
Topics: 90
Location: Bangalore India

PostPosted: Tue Aug 29, 2006 2:33 pm    Post subject: Reply with quote

shiv_swami,

To refer elements within a table you have to use one of these:

1.Subscript
2.Index
3.Use both Subscript and Index together.
_________________
Shekar
Grow Technically
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12372
Topics: 75
Location: San Jose

PostPosted: Tue Aug 29, 2006 2:52 pm    Post subject: Reply with quote

shiv_swami,

As shekhar mentioned you can access the table via subscript or index. But if you are accesing the table via subscript it defeats the whole purpose of defining the table with an Index.

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
DeepuMVS
Beginner


Joined: 30 Aug 2006
Posts: 1
Topics: 0

PostPosted: Wed Aug 30, 2006 9:00 am    Post subject: Reply with quote

Kolusu,

What happens when you reference the table with a subscript having a value of ZERO. Would it abend. As per the COBOL lang. reference book ZERO is acceptable.

Please explain more..

Thanks,
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12372
Topics: 75
Location: San Jose

PostPosted: Wed Aug 30, 2006 9:06 am    Post subject: Reply with quote

Quote:

What happens when you reference the table with a subscript having a value of ZERO. Would it abend. As per the COBOL lang. reference book ZERO is acceptable.

Please explain more..


Please SEARCH before posting. Check this link which explains your question

http://www.mvsforums.com/helpboards/viewtopic.php?t=5242&highlight=ssrange

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Deepubonds
Beginner


Joined: 08 Mar 2005
Posts: 16
Topics: 2

PostPosted: Wed Aug 30, 2006 10:05 am    Post subject: Reply with quote

Hi Kolusu,

I am facing a strange situation. The program is being compiled with SSR compiler option, yet the program is not abending in developement region, where as it is abending in PROD region, when referencing zeroth element in the array.

Have you faced such a situation any time. Any possible difference in these two regions (prod & dev) that you can think of. Idea ?
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12372
Topics: 75
Location: San Jose

PostPosted: Wed Aug 30, 2006 10:18 am    Post subject: Reply with quote

Quote:

The program is being compiled with SSR compiler option, yet the program is not abending in developement region, where as it is abending in PROD region, when referencing zeroth element in the array.


May be your development region has an compiler override. Did you see the compiler listing and was SSRANGE ?

If the pgm was compiled with SSRANGE and it is not abending, then may be the pgm is accessing that paragraph in the development region

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Deepubonds
Beginner


Joined: 08 Mar 2005
Posts: 16
Topics: 2

PostPosted: Wed Aug 30, 2006 10:31 am    Post subject: Reply with quote

Quote:

If the pgm was compiled with SSRANGE and it is not abending, then may be the pgm is accessing that paragraph in the development region


In the above, do you mean .." then may be the pgm is not accessing.." ?

The paragraph is being called both in dev & prod.
Also, I verified that the compiler is using SSR compiler option.

Thanks,
Deepu
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12372
Topics: 75
Location: San Jose

PostPosted: Wed Aug 30, 2006 10:40 am    Post subject: Reply with quote

Deepubonds,

Is LE enabled in the development region ? Run your pgm with the following parm and CEEDOPT DD and check the LE default setting.

Code:

//STEP0100 EXEC PGM=YOUR COBOL PGM,PARM='/RPTOPTS(ON),MSGFILE(CEEDOPT)'
//CEEDOPT  DD SYSOUT=*


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Deepubonds
Beginner


Joined: 08 Mar 2005
Posts: 16
Topics: 2

PostPosted: Wed Aug 30, 2006 11:56 am    Post subject: Reply with quote

Hi Kolusu,

The program thats abending is a online COBOL program.

However LE is in effect in DEV & quality region, while not in effect in PROD region. I am guessing this could be the possibly reason. Yet need to confirm.

Do you know what is it of LE that is could be causing the problem in prod.

Thanks,
Deepu
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12372
Topics: 75
Location: San Jose

PostPosted: Wed Aug 30, 2006 12:09 pm    Post subject: Reply with quote

Quote:

However LE is in effect in DEV & quality region, while not in effect in PROD region. I am guessing this could be the possibly reason. Yet need to confirm.

Do you know what is it of LE that is could be causing the problem in prod.



Deepubonds,

NO I think the other way round. LE Option TRAP was turned OFF in the Development and Quality region and was turned ON in the production region.

The TRAP option allows LE to intercept an abnormal termination (abend), provide the abend information,and then terminate the LE run-time environment. TRAP(ON) also assures that all files are closed when an abend is encountered and is required for proper handling of the ON SIZE ERROR clause of arithmetic statements for overflow conditions. TRAP(OFF) prevents LE from intercepting the abend.

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Deepubonds
Beginner


Joined: 08 Mar 2005
Posts: 16
Topics: 2

PostPosted: Wed Aug 30, 2006 12:13 pm    Post subject: Reply with quote

Ran the program against DEV & PROD. The LE options in dev & PROD are shown as same in CEEDOPT.
Back to top
View user's profile Send private message
Deepubonds
Beginner


Joined: 08 Mar 2005
Posts: 16
Topics: 2

PostPosted: Wed Aug 30, 2006 12:14 pm    Post subject: Reply with quote

TRAP(ON,SPIE) is what I saw in dev, Quality & PROD.

Thanks,
Purshi
Back to top
View user's profile Send private message
Deepubonds
Beginner


Joined: 08 Mar 2005
Posts: 16
Topics: 2

PostPosted: Wed Aug 30, 2006 12:21 pm    Post subject: Reply with quote

Hi Kolusu,

Discussion has been very informative so far. Problem still persists. But, thanks for your time and quick response Kolusu!

Regards,
Deepu
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12372
Topics: 75
Location: San Jose

PostPosted: Wed Aug 30, 2006 12:30 pm    Post subject: Reply with quote

Deepubounds,

Run the following job as is in the development region and see if it abends.

Code:

//STEP0100 EXEC PGM=IGYCRCTL
//STEPLIB  DD DSN=SYS1.SIGYCOMP,
//            DISP=SHR
//SYSPRINT DD SYSOUT=*
//SYSTERM  DD SYSOUT=*
//SYSUT1   DD UNIT=DISK,SPACE=(CYL,(10,2))
//SYSUT2   DD UNIT=DISK,SPACE=(CYL,(10,2))
//SYSUT3   DD UNIT=DISK,SPACE=(CYL,(10,2))
//SYSUT4   DD UNIT=DISK,SPACE=(CYL,(10,2))
//SYSUT5   DD UNIT=DISK,SPACE=(CYL,(10,2))
//SYSUT6   DD UNIT=DISK,SPACE=(CYL,(10,2))
//SYSUT7   DD UNIT=DISK,SPACE=(CYL,(10,2))
//SYSLIN   DD DSN=&&LOADSET,
//            DISP=(MOD,PASS),
//            UNIT=SYSDA,
//            SPACE=(CYL,(1,1),RLSE)
//SYSIN    DD  *
       CBL SSRANGE
       IDENTIFICATION DIVISION.
       PROGRAM-ID.    SAMPLE
       DATE-COMPILED.
       ENVIRONMENT DIVISION.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01 W-SUB                     PIC S9(04) COMP VALUE 0.

       01 T-INTERNAL-TABLE-AREA.
           05 INTERNAL-TABLE        OCCURS 6 TIMES
                                    ASCENDING KEY IS  T-CODE
                                    INDEXED BY CR-INDEX.
              10  T-CODE              PIC  X(01).
              10  T-AMT               PIC  9(09).

       PROCEDURE DIVISION.

             MOVE 'A'    TO T-CODE(1)
             MOVE 1000   TO T-AMT (1)

             MOVE 'B'    TO T-CODE(2)
             MOVE 0      TO T-AMT (2)

             MOVE 'C'    TO T-CODE(3)
             MOVE 2000   TO T-AMT (3)

             MOVE 'D'    TO T-CODE(4)
             MOVE 2000   TO T-AMT (4)

             MOVE 'E'    TO T-CODE(5)
             MOVE 1500   TO T-AMT (5)

             MOVE 'F'    TO T-CODE(6)
             MOVE 5000   TO T-AMT (6)

             MOVE 6 TO W-SUB

             PERFORM 7 TIMES
               COMPUTE W-SUB = W-SUB - 1
               DISPLAY 'T-CODE: ' T-CODE(W-SUB)
               DISPLAY 'T-AMT : ' T-AMT (W-SUB)
               DISPLAY 'W-SUB : ' W-SUB
             END-PERFORM

             GOBACK
             .
/*
//*********************************************************************
//STEP0200 EXEC PGM=LOADER,
//             PARM=('LIST,LET,XREF,DCBS,'),
//             COND=(5,LT,STEP0100)
//SYSLIB   DD DSN=SYS1.SCEELKED,
//            DISP=SHR
//SYSLIN   DD DSNAME=*.STEP0100.SYSLIN,DISP=(OLD,DELETE)
//SYSUDUMP DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSOUT   DD SYSOUT=*
/*


Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group