How to initialize a group data which is containing occur clause?

Showing Answers 1 - 21 of 21 Answers

Venkata999

  • Mar 19th, 2006
 

Hi Friend,

#.1 . Here is an example for how to initialize the  normal  group variable   .

ex :   01  ws-details .

             02  ws-name    a(10 )  .

             02  ws-desig      a(5)    .

move  spaces   to  ws-details   .

#.2  . If occurs clase exist , here is the example 

move  all spaces  to  ws-details  .

The only diff is we need put the "  all "   .  Same can be done using perform  and repeting loop   equal no of occur times .

Hope this will  help  ....

  Was this answer useful?  Yes

gomathy

  • Mar 27th, 2006
 

Hi,

VS COBOL II supports group initialization of occurs clause as well.

E.G. 01 WS-TEST.

               05 WS-TEST1 OCCURS 100 TIMES.

               05 WS-TEST2 OCCURS 200 TIMES.

INITIALIZE WS-TEST will work.

Thanks.

  Was this answer useful?  Yes

Siva

  • Apr 21st, 2006
 

Hi, Group data that contains OCCURS Clause can be initialized/set to a default value using VALUE clause as mentioned below.01 ARRAY3 VALUE '0102030405'. 02 TABLEDUMMY3 OCCURS 5 TIMES. 05 SNO3 PIC 99.

  Was this answer useful?  Yes

ajay

  • Apr 27th, 2006
 

Hi,

let us take and example:

01 ws-array value 'abcdefghijklmnop'

    02 ws-a1 pic x(1) occurs 17 times.

if u initialize ws-array then by default

ws-a1(1) will contain 'a' value

ws-a1(2) will contain 'b' value

ws-a1(2) will contain 'c' value....

please let me know if u have any concerns..!!

Thanks

ajay

 

  Was this answer useful?  Yes

ATUL BANKE

  • Jun 9th, 2006
 

Here is the example:

01 WS-REC.

    02 TAB OCCURS 10 TIMES.

         05 EM-NAME PIC X(5).

         05 EM-PHONE PIC 9(10).

  Was this answer useful?  Yes

sanjeev_16

  • Aug 25th, 2009
 

01 SALES-TABLE. 
02 SALES-DETAIL OCCURS 100 TIMES.
COPY DDS-ALL-FORMAT OF EMPPF.
If a group data is using database reference, where emppf is logical file name.

  Was this answer useful?  Yes

satheesh

  • May 22nd, 2016
 

We have to use perform to intialize, we have to loop as many tiimes as occures decalred

  Was this answer useful?  Yes

Steve

  • May 23rd, 2017
 

Perform varying sub from 1 by 1 until sub is greater than the occurs area. Move spaces or zeros to the fields in the occurs.

  Was this answer useful?  Yes

Guest

  • Apr 3rd, 2018
 

Hi,
I have query regarding the initialization of occur clause.
01 WS-TABLE.
02 WS-DETAIL OCCURS 20 TIMES.
COPY DDS-ALL-FORMAT OF TESTPF.
Query - How can I initialize WS-DETAIL for particular index 5 where up to index 4 having data in WS-DETAIL?

  Was this answer useful?  Yes

nids

  • Jan 17th, 2019
 

Perform varying sub from 4 by 1 until sub is greater than the occurs area. Move spaces or zeros to the fields in the occurs.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions