Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

blank in the output file after writing each record

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: blank in the output file after writing each record
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

Site Director


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

PostPosted: Wed Dec 05, 2007 3:30 am    Post subject:
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: 6968
Location: porcelain throne

PostPosted: Wed Dec 05, 2007 12:30 pm    Post subject:
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    Post subject: Reply to: blank in the output file after writing each record
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

Site Director


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

PostPosted: Wed Dec 05, 2007 9:52 pm    Post subject:
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    Post subject:
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    Post subject:
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.

http://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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Write out NODUPS but just from one file Jay Villaverde DFSORT/ICETOOL 8 Fri Jul 14, 2017 12:44 am
No new posts How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts How to generate a new unique Input fi... for1ranjith CLIST & REXX 11 Sat Jul 01, 2017 12:09 pm
No new posts Writing a file using online program grvtomar PL/I & Assembler 3 Fri Jun 30, 2017 1:06 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us