Note that you may be getting a CRLF at the start of the file because you are using AFTER advancing.But my output file layout has the last field of length 8 characters which could have variable length values ranging from spaces to 8 characters.Just WRITE Second, go with OUTPUT IS SEQUENTIAL Third: If the record is to be 300 bytes PLUS the CRLF, define the record as 302 bytes and manually insert a CRLF as the last two bytes.
Micro Focus Cobol Code For DefiningPillasso, It might help if you posted the code for defining the file and record format if the following doesnt help. However, in the case of the LINE SEQUENTIAL the file routines AUTOMATICALLY tack on CRLF (x0d0a) after your specified record length (and the CRLF is NOT included in your record size). The difference between the two - viewing them on a screen, (using a DOS text viewer), SEQUENTIAL wraps around when it hits the screen width, whereas the LINE SEQUENTIAL displays each succeeding record on a NewLine when it hits x0d0a. Hence the latter can be viewed easily from Notepad or whatever, or just use the OS to print the file. Check the on-line help - the following from WRITE for FORMAT 1 - Record and Line Sequential files, (which also covers Frederico Fonsecas suggestion of WRITE BEFORE.). The WRITE statement releases a logical record for an output or input-output file. For sequential files it can also be used for vertical positioning of lines within a logical page. The student I referred to had used MF shorthand to define files:- INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT INPUT-RECORD ASSIGN TO proj4.oms. SELECT ERROR-RECORD ASSIGN TO proj4.err. SELECT ERROR-REPORT ASSIGN TO proj4.rpt. The fixed length input file proj4.oms was DEFINITELY a SEQUENTIAL but I could read it as either SEQUENTIAL or LINE SEQUENTIAL - and the following clarification from Chris Glazier on MF Answer Exchange:- You can read this, (. The next record read will do the same thing and again will fill the contents of the data record. I think you are after fixed length records, but if you were using Variable - as you go to write you must stipulate your current record size using ws-RecordSize. When reading records the current ws-RecordSize is automatically returned to you. If you truly have a requirement to have the record varible from 292 to 300 then change the record format to:- FD Data-File record varying from 292 to 300 characters depending on ws-RecordSize. Data-record pic x(300). But, do you really want to economize on 8 characters Hope above helps - if not post the file definitions you are having a problem with. Jimmy, Calgary AB ---------------- I have a requirement where in I have to create an output file of fixed length ie. Each record should also be delimited by the newline character. ![]() I tried defining the file as record sequential file.and I am using the write after advancing 1 line option while writing to the output file.But I see a M character after the 300th character which is not desirable. Is there any way we could keep the file length fixed always to 300 and also have a newline character after each record so that I am able to view the file using the vi editor in unix and also keep up the vendors requreiment of fixed length Thanks Pillasso -- Posted via. In most cases, yes. Some versions of Fujitsu didntdont truncate spaces and a fixed record is written. There is a run-time variable that can set this for versions that recognise it. You dont say what your OS or compiler is so it is hard to give definite advice.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |