Skip to main content

Difference displaying a String vs PIC X

  • March 2, 2015
  • 7 replies
  • 0 views

Juan Urraburu

Hi,

I have some texts defined as System.String or String inside Visual COBOL for Visual Studio 2012 and some defined as pic x.

I can not find how to display a variable defined as string using line and column without receiving a compilation error COBCH030. And the display of the pic x is shown in a different color (green) than the display of the string (white)

01 text1 type System.String.
01 thetext pic x(50).
       procedure division.
           set text1 thetext to "Hello World".
           display text1::Trim.
                     
           display thetext line 20 position 20.

Regards,

7 replies

Chris Glazier
Forum|alt.badge.img+2

Hi,

I have some texts defined as System.String or String inside Visual COBOL for Visual Studio 2012 and some defined as pic x.

I can not find how to display a variable defined as string using line and column without receiving a compilation error COBCH030. And the display of the pic x is shown in a different color (green) than the display of the string (white)

01 text1 type System.String.
01 thetext pic x(50).
       procedure division.
           set text1 thetext to "Hello World".
           display text1::Trim.
                     
           display thetext line 20 position 20.

Regards,

Hi Juan,

Currently only format 1 of the display statement is supported if you are using managed data types such as string. If you wish to use the full capabilities of enhanced accept/display statements such as line positioning then you must use COBOL data items defined with the PIC clause.

When I run your example here, both statements are displayed in white. What other compiler directives are you using?


Juan Urraburu
  • Author
  • Participating Frequently
  • March 3, 2015

Hi,

I have some texts defined as System.String or String inside Visual COBOL for Visual Studio 2012 and some defined as pic x.

I can not find how to display a variable defined as string using line and column without receiving a compilation error COBCH030. And the display of the pic x is shown in a different color (green) than the display of the string (white)

01 text1 type System.String.
01 thetext pic x(50).
       procedure division.
           set text1 thetext to "Hello World".
           display text1::Trim.
                     
           display thetext line 20 position 20.

Regards,

Thank you Chris!

I have the default installation with no directive and the default Build settings as:

anim cobidy".\\bin\\Debug\\" sourceformat"Variable" warnings"2" max-error"100" ilgen noint iltarget"x86" constant"DEBUG(1)"


Chris Glazier
Forum|alt.badge.img+2

Hi,

I have some texts defined as System.String or String inside Visual COBOL for Visual Studio 2012 and some defined as pic x.

I can not find how to display a variable defined as string using line and column without receiving a compilation error COBCH030. And the display of the pic x is shown in a different color (green) than the display of the string (white)

01 text1 type System.String.
01 thetext pic x(50).
       procedure division.
           set text1 thetext to "Hello World".
           display text1::Trim.
                     
           display thetext line 20 position 20.

Regards,

Which product version are you using?

I am testing with 2.2 update 2 and my displays are all in white.


Hi,

I have some texts defined as System.String or String inside Visual COBOL for Visual Studio 2012 and some defined as pic x.

I can not find how to display a variable defined as string using line and column without receiving a compilation error COBCH030. And the display of the pic x is shown in a different color (green) than the display of the string (white)

01 text1 type System.String.
01 thetext pic x(50).
       procedure division.
           set text1 thetext to "Hello World".
           display text1::Trim.
                     
           display thetext line 20 position 20.

Regards,

I am trying to accomplish the same thing. When I launch a cobol console app, the text is green.

Hi,

I have some texts defined as System.String or String inside Visual COBOL for Visual Studio 2012 and some defined as pic x.

I can not find how to display a variable defined as string using line and column without receiving a compilation error COBCH030. And the display of the pic x is shown in a different color (green) than the display of the string (white)

01 text1 type System.String.
01 thetext pic x(50).
       procedure division.
           set text1 thetext to "Hello World".
           display text1::Trim.
                     
           display thetext line 20 position 20.

Regards,

running cobol server 2.3

Hi,

I have some texts defined as System.String or String inside Visual COBOL for Visual Studio 2012 and some defined as pic x.

I can not find how to display a variable defined as string using line and column without receiving a compilation error COBCH030. And the display of the pic x is shown in a different color (green) than the display of the string (white)

01 text1 type System.String.
01 thetext pic x(50).
       procedure division.
           set text1 thetext to "Hello World".
           display text1::Trim.
                     
           display thetext line 20 position 20.

Regards,

running cobol server 2.3

Hi,

I have some texts defined as System.String or String inside Visual COBOL for Visual Studio 2012 and some defined as pic x.

I can not find how to display a variable defined as string using line and column without receiving a compilation error COBCH030. And the display of the pic x is shown in a different color (green) than the display of the string (white)

01 text1 type System.String.
01 thetext pic x(50).
       procedure division.
           set text1 thetext to "Hello World".
           display text1::Trim.
                     
           display thetext line 20 position 20.

Regards,

running cobol server 2.3