[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1535
  • Last Modified:

COBOL to flat file (comma delimited)

Do you know of any tool(s) that I can use to extract and convert COBOL data off an OPENVMS machine to a comma delimited flat file format.  We are using COBOL 5.5 on the OPENVMS machine.
0
NBilly
Asked:
NBilly
  • 2
  • 2
2 Solutions
 
Dang123Commented:
NBilly,
    What do you mean by COBOL data? What type of file is the data stored in? The COBOL I have seen in OPENVMS have worked with flat files, openable with edit.

Dang123
0
 
NBillyAuthor Commented:
The data is stored in ISAM format.
0
 
Dang123Commented:
NBilly,
    I don't know of an OPENVMS utility to dump an ISAM file. You would probably be best off writing a quick little COBOL program to do the dump. Something like this should get the job done.

PROCEDURE DIVISION.
MAINLINE SECTION.
    OPEN INPUT CUR-FILE
         OUTPUT FLAT-FILE
    IF CUR-STATUS > 0
        DISPLAY 'BAD OPEN'
        {stop the program}
    END-IF
   
    MOVE LOW-VALUES TO CUR-KEY
    START CUR-FILE KEY IS GREATER THAN CUR-KEY
    READ CUR-FILE
      NEXT RECORD
      AT END
          MOVE 'N' TO MORE-REC-LEFT.

    PERFORM DUMP-LOGIC
        UNTIL MORE-REC-LEFT = 'N'

    CLOSE INPUT CUR-FILE
         OUTPUT FLAT-FILE

    STOP RUN.

DUMP-LOGIC.
    MOVE CUR-FIELD1 TO FLAT-FIELD1
    MOVE CUR-FIELD2 TO FLAT-FIELD2
      .
      .
      .
    MOVE CUR-FIELDn TO FLAT-FIELDn

    WRITE FLAT-REC
   
    READ CUR-FILE
      NEXT RECORD
      AT END
          MOVE 'N' TO MORE-REC-LEFT.
DUMP-LOGIC-EXIT. EXIT.

    Hope that helps.

Dang123
0
 
NBillyAuthor Commented:
Thank you for your suggestion.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now