IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

blank in the output file after writing each record


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
gchitra

New User


Joined: 08 Jun 2005
Posts: 36
Location: Burtonsville, MD

PostPosted: Wed Dec 05, 2007 1:07 am
Reply with quote

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.

Chitra
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Dec 05, 2007 3:30 am
Reply with quote

Hello,

It sounds like you are actually creating fixed length records that are padded with spaces when you move the data to the record.

Please post both fd's, the working storage area(s), the procedure division that creates/writes the output, and the jcl.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Dec 05, 2007 12:30 pm
Reply with quote

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.
Back to top
View user's profile Send private message
gchitra

New User


Joined: 08 Jun 2005
Posts: 36
Location: Burtonsville, MD

PostPosted: Wed Dec 05, 2007 7:05 pm
Reply with quote

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).

***********************************************************
Working-Storage:
01 CNU-RECORD.
05 CNU-VERSION-DATA.
10 CNU-VER-CODE PIC X(01) VALUE 'R'.
10 CNU-VER-NUMBER PIC X(01) VALUE '2'.
05 CNU-PSC-CODE PIC X(01).
05 CNU-COMPLETION-CODE PIC X(01).
05 CNU-ZIP-CODE PIC X(05).
05 CNU-CAN-BIC.
10 CNU-CAN PIC X(09).
10 CNU-BIC PIC X(03).
05 FILLER PIC X(18).
05 CNU-SYSTEM-ID PIC X(02).
05 CNU-SUB-SYSTEM-ID PIC X(02).
05 CNU-NOTICE-TYPE PIC X(03).
05 FILLER PIC X(03).
05 CNU-LANGUAGE-TYPE PIC X(01).
05 CNU-JULIAN-RUNDATE.
10 CNU-JDATE-YY PIC X(02).
10 CNU-JDATE-DDD PIC X(03).
05 CNU-BLIND-INDICATOR PIC X(01).
05 FILLER PIC X(25).
05 CNU-RPD-MMDDYY.
10 CNU-RPD-MM PIC X(02).
10 CNU-RPD-DD PIC X(02).
10 CNU-RPD-YY PIC X(02).
05 FILLER PIC X(04).
05 CNU-REVIEW-CODE PIC X(01).
88 REVIEW VALUE '1'.
88 NO-REVIEW VALUE '2'.
05 CNU-SEGMENT-NUM PIC X(02).
05 FILLER PIC X(31).
05 CNU-UTI-FILLIN-DATA.
10 CNU-UTI-FILLIN PIC X(01)
OCCURS 30150 TIMES
INDEXED BY M.

***********************************************************
Procedure Division Entries:
PERFORM 300-READ-FILE THRU 300-READ-FILE-EXIT
UNTIL WS-COUNT = WS-UTI-COUNT


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.


Below is the JCL:
//SKCMPPR EXEC PGM=SKCMPLK1,PARM='MPD09306'
//*SKCMPPR EXEC PGM=SKCMPLK1,PARM='SSAH1603'
//STEPLIB DD DSN=ENDV.IVEN.IVENCNNS.DEVBLOAD,DISP=SHR
// DD DSN=ENDV.BATCHCOM.PRDBLOAD,DISP=SHR
//SYSPRINT DD SYSOUT=*
//SYSOUR DD DSN=$1591.SYSOUR.CHITRA.SSAH165,
// UNIT=STORAGE,LRECL=80,RECFM=FB,
// DISP=(NEW,CATLG,CATLG),SPACE=(TRK,(1,1),RLSE)
//SKELCMPI DD DSN=SSA.ET994.T2MM8.MAP47.CHITRA.MSD.SKELC1,
// DISP=SHR
//SKELCMPO DD DSN=$1591.CHITRA.SKELCOMP.OUTPUT,
// SPACE=(TRK,(100,100),RLSE),LRECL=30279,RECFM=VB,
// DISP=(NEW,CATLG,CATLG),BLKSIZE=32000,UNIT=STORAGE
//REPORT DD DSN=$1591.CHITRA.SKELCOMP.REPORT,LRECL=80,RECFM=FB,
// DISP=(NEW,CATLG,DELETE),SPACE=(TRK,(100,100),RLSE),
// UNIT=STORAGE
//*

Dick, Please let me know if you need anything else and thank you very much for the help.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Dec 05, 2007 9:52 pm
Reply with quote

Hello,

Your FD specifies V, but there is only 1 fixed-length record layout.

To actually write variable length records, you need to specify something that varies. . .
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Wed Dec 05, 2007 9:57 pm
Reply with quote

You are writing Variable records but with that FD and 01 entries they will all be the same size.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Thu Dec 06, 2007 3:24 am
Reply with quote

Take a look at the code provided in the last post of this link and compare what you're doing in yours.

www.ibmmainframes.com/viewtopic.php?t=26315
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts TRIM everything from input, output co... DFSORT/ICETOOL 1
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
Search our Forums:

Back to Top