Unconfigured Ad Widget

Collapse

Announcement

Collapse
No announcement yet.

How to write mangled data to a file?

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

  • How to write mangled data to a file?

    Move the existing file definition from the file section into working storage. Use your DDS file definition in the file section. You can then move the "01" level to the corresponding "01" level. My guess is that this program was originally written for a mainframe, or the S/36. In either case, the mixed data types would not cause an error. Using COBOL/400 or ILE COBOL is a problem here because a data type error will definitely occur, unless caution is taken. Dave

  • #2
    How to write mangled data to a file?

    The COBOL prog was indeed ported from a mainframe to an AS400. And I think I did not sufficiently explain that I can modify only the RPG prog, not the COBOL prog. Can RPGILE write mangled data to these fields?

    Comment


    • #3
      How to write mangled data to a file?

      If you use a program-described file, you can make an RPG program write whatever you want to those fields. Given a sample couple of values for the two RPG fields, say 1234567890 and 123456789, what do you want the COBOL version of those eleven bytes to look like?

      Comment


      • #4
        How to write mangled data to a file?

        I want the COBOL prog to see zero's where it expects it's 3 numeric fields to be.

        Comment


        • #5
          How to write mangled data to a file?

          I have inherited a Cobol program that processes a physical file and it requires that certain fields within the file be formatted as they were of some other format. From a DDS (and RPG) point of view, 2 fields appear thus: FIELD1A 10P2 (6 bytes) FIELD1B 9P2 (5 bytes) They are processed by the Cobol prog as if they were FIELD2A 12P2 (7 bytes) FIELD2B 1S0 (1 bytes) FIELD2C 4P2 (3 bytes) Note that in both cases the total size of all fields is 11 bytes (ie, they both fit neatly into the same space). Being an RPGILE programmer, I find this Cobol concept a little bizarre. If I simply put 0 (zero) in FIELD1A and FIELD1B via an RPG prog then the Cobol prog crashes. Can an RPG program write to these fields such that the Cobol program can make sense of it?

          Comment


          • #6
            How to write mangled data to a file?

            I had never seen an example of a program-described file before, so it took quite a lot of research. But I figured it out and it worked well. It seems to be exactly as Barbara said - using a program-described file, you can make an RPG program write whatever you want. And I imagine this would be a terrific way to defile a data base's integrity.

            Comment

            Working...
            X