Joined: 08 Jun 2005 Posts: 36 Location: Burtonsville, MD
I am writing a VB file that has the same record as that of the input file but only those that matches the required criteria should be written. The number of records in the output file are correct, but there are lot of spaces after each record.
Can anyone suggest a way to get rid off those spaces? I am reading the input file into a ws variable and if the criteria matches, the output record is written from the ws variable.
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
or optionally, the cobol ref manual (or user reference) for the cobol that you are using will explain how and provide you the syntax necessary to read and write variable length records. you could compare your code to that.
Joined: 08 Jun 2005 Posts: 36 Location: Burtonsville, MD
The string that is passed through the JCL is located after the byte 125 in the input file which is specified by the field CNU-UTI-FILLIN-DATA in the CNU-RECORD layout. Following are the details you requested:
FD Entries:
Input File:
FD SKELCMPI
RECORDING MODE IS V
LABEL RECORDS ARE STANDARD.
01 SKELCMPI-REC PIC X(30275).
***********************************************************
Output File:
FD SKELCMPO
RECORDING MODE IS V
LABEL RECORDS ARE STANDARD.
01 SKELCMPO-REC PIC X(30275).
300-READ-FILE.
INITIALIZE CNU-RECORD.
READ SKELCMPI INTO CNU-RECORD.
PERFORM 400-PROCESS-FILE THRU 400-PROCESS-FILE-EXIT
VARYING M FROM 1 BY 1
UNTIL MATCH-FOUND OR END-OF-RECORD.
400-PROCESS-FILE.
SET A TO M.
MOVE CNU-UTI-FILLIN-DATA (A:6) TO WS-COPY-UTI
IF WS-COPY-UTI = WS-UTI-NUM
DISPLAY 'UTI NUM :' WS-UTI-NUM
MOVE 'Y' TO WS-MATCH-SW
PERFORM 500-WRITE-FILE THRU 500-WRITE-FILE-EXIT
COMPUTE WS-COUNT = WS-COUNT + 1
ELSE
CONTINUE
END-IF.
500-WRITE-FILE.
INITIALIZE WS-SKELCOMPO-REC
MOVE CNU-RECORD TO WS-SKELCOMPO-REC.
WRITE SKELCMPO-REC FROM CNU-RECORD.
ADD 1 TO WS-WRITE-COUNT
IF WS-STATUS-CD-SKELCMPO > '10'
MOVE WS-STATUS-FD-SKELCMPO TO WS-GEN-FD-NAME
MOVE WS-STATUS-CD-SKELCMPO TO WS-GEN-STATUS-CD
MOVE WS-STATUS-OPEN TO WS-GEN-IO-OPERATION
PERFORM 9000-FILE-STATUS-ERROR
END-IF.