ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

another friday cobol question

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • another friday cobol question

    hello all....

    is there an equivalent cobol statement that would behave similar to the varying statement that is available for variable length in RPGLE?

    i know with RPGLE, i could use a data structure with a varying length and do %trim to eliminate any blanks....does cblle have anything like that?

    my coworker is attempting to write a quick program to pass data for use with xml request...but the request could possibly produce 1 record or xxx number of records...he believes using 01 level and coding static number (say 100) will pass 99 blank records should only 1 match be found...he does not know any other language besides opm cobol so i'm trying to find better way of coding...

    any help is appreciated as always...

    caren

  • #2
    Re: another friday cobol question

    is there an equivalent cobol statement that would behave similar to the varying statement that is available for variable length in RPGLE?
    Are you referring to an RPG defined variable in D-Specs?

    As far as I know, the only variable data types permitted are those defined in data records. I am unaware of any variable length data types that can be defined in Working Storage according to the last COBOL draft standard.
    i know with RPGLE, i could use a data structure with a varying length and do %trim to eliminate any blanks....does cblle have anything like that?
    In V5R4, the TRIML, TRIMR and TRIM intrinsic functions were added to ILE/Cobol. In fact, I just used these extensively today to build a CSV record via the STRING statement...it worked great!
    my coworker is attempting to write a quick program to pass data for use with xml request...but the request could possibly produce 1 record or xxx number of records...he believes using 01 level and coding static number (say 100) will pass 99 blank records should only 1 match be found...he does not know any other language besides opm cobol so i'm trying to find better way of coding...
    I'm not sure I understand the problem. Is he communicating via XML with a C program, a web service, etc?? I'm not very familiar with XML but I know that there is XML parsing in V5R3. In V5R4, XML generation was added. Information is available in the ILE COBOL Programmers guide located here:




    Terry

    Comment


    • #3
      Re: another friday cobol question

      From the top of my head I recall the old days when we used
      PHP Code:
      01 MyVaryingLengthField PIC X OCCURS 1 TO 100 DEPENDING ON Counter
      to get a so-called variable length field but you ought to know how "long" is the value to populate the Counter with.
      It'd likely exist some newer way nowadays.
      Last edited by Mercury; September 26, 2008, 11:15 AM.
      Philippe

      Comment


      • #4
        Re: another friday cobol question

        Good one Philippe!

        I wasn't sure that the occurs technique was the same as the RPG varying keyword.

        Hmmm...maybe I should learn a little more about RPG ;-)

        Terry
        TGIF

        Comment

        Working...
        X