Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6604991
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:13:49+00:00 2026-05-25T19:13:49+00:00

I am getting very strange scenario. I have one array defined in my COBOL

  • 0

I am getting very strange scenario. I have one array defined in my COBOL pgm.

05  A-TABLE.                                   
    10  A-TABLE-LIST OCCURS 10 TIMES INDEXED BY A-IDX. 

        15  FILLER              PIC X(7) VALUE '<TEST>'. 
        15  A-LIST-VALUE        PIC X(30).                
        15  FILLER              PIC X(8) VALUE '</TEST>'.

I am setting A-IDX=1 and moving ‘XYZ’ to A-LIST-VALUE(A-IDX).
While displaying A-TABLE, it is showing as
XYZ——————————
and all spaces… 🙁
I am not getting what is the issue here?
Can anyone help me to resolve this?

Regards,
Saisha.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T19:13:49+00:00Added an answer on May 25, 2026 at 7:13 pm

    You cannot set values for a table that way. One way to set values in a table is to use a REDEFINES and a separate data area.

    05  A-TABLE-X.
        10  FILLER PIC X(45)
            VALUE '<TEST>                              </TEST>'.
        10  FILLER PIC X(45)
            VALUE '<TEST>                              </TEST>'.
        10  FILLER PIC X(45)
            VALUE '<TEST>                              </TEST>'.
        10  FILLER PIC X(45)
            VALUE '<TEST>                              </TEST>'.
        10  FILLER PIC X(45)
            VALUE '<TEST>                              </TEST>'.
        10  FILLER PIC X(45)
            VALUE '<TEST>                              </TEST>'.
        10  FILLER PIC X(45)
            VALUE '<TEST>                              </TEST>'.
        10  FILLER PIC X(45)
            VALUE '<TEST>                              </TEST>'.
        10  FILLER PIC X(45)
            VALUE '<TEST>                              </TEST>'.
        10  FILLER PIC X(45)
            VALUE '<TEST>                              </TEST>'.
    
    05  A-TABLE REDEFINES A-TABLE-X.     
        10  A-TABLE-LIST OCCURS 10 TIMES INDEXED BY A-IDX. 
    
            15  FILLER              PIC X(7). 
            15  A-LIST-VALUE        PIC X(30).                
            15  FILLER              PIC X(8).
    

    That is pretty cumbersome. Another method is to MOVE the data in at runtime in an initialisation paragraph.

    05  A-TABLE REDEFINES A-TABLE-X.     
        10  A-TABLE-LIST OCCURS 10 TIMES INDEXED BY A-IDX. 
    
            15  A-LIST-A            PIC X(7). 
            15  A-LIST-VALUE        PIC X(30).                
            15  A-LIST-B            PIC X(8).
    
    PERFORM VARYING A-IDX FROM 1 BY 1 UNTIL A-IDX > 1
      MOVE '<TEST> TO A-LIST-A(A-IDX)
      MOVE SPACES TO A-LIST-VALUE(A-IDX)
      MOVE '</TEST> TO A-LIST-B(A-IDX)
    END-PERFORM
    

    I didn’t try compiling any of these, this is just freehand.

    As a side note, if you are using Enterprise COBOL version 3.2 or higher and you are trying to create XML in COBOL, there exists an XML GENERATE statement.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm getting a very strange behaviour in one of my JSP pages. It looks
I am getting a very strange error message at one of our client sites
I am getting a very strange error on one of my Silverlight 4.0 pages.
I'm getting a very strange error. In my XAML I have two MediaElement tags
Very strange error I have, I am getting request as null when I try
We are getting very slow compile times, which can take upwards of 20+ minutes
I'm getting very strange logs tagged 'webcore' when trying to input number in textfield.
I'm getting a very strange behavior in MySQL, which looks like some kind of
I'm getting so very strange behavior in my Objective C library (for iPhone). What
I'm getting a very strange crash due to iAd. Here's the debugger output: 2010-07-29

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.