From: William M. Klein on
OK, I think I understand the "desire". You want to use X"0A" but *not* X"0D0A"
as the record delimiter for line sequential files. (Something that is
"operating system" and/or application dependent). Your desire is to be able to
have X"0D" *data* in LINE SEQUENTIAL files.

From a "usually reliable source" Micro Focus *does* support (allow) this. The
following is the solution that I was provided:
***
"File Handler configuration option LSRECDELIM set in EXTFH.CFG can be used to
set the record delimiter used for LSEQ files.

Syntax:

LSRECDELIM=[0A|0D0A]

Parameters:

0A The hexadecimal character x"0A" is used as the record delimiter for line
sequential files.

0D0A The hexadecimal characters x"0D0A" are used as the record delimiter for
line sequential files."


--
Bill Klein
wmklein <at> ix.netcom.com
<taoxianfeng(a)gmail.com> wrote in message
news:75979a92-6155-4583-9cf4-c80425d1b015(a)v39g2000pro.googlegroups.com...
> Hi all
>
> I'm writing a batch source to match 2 input files which is exported
> from AIX DB2 giving the matched records.
>
> All other characters are going well except X'0D':all of them get lost
> when reading the input files into the program. I tried many file
> handler options and runtime switches but no one worked. Any advice is
> appreaciated. Thanks in advance!
>
> Line sequential file, variable-length record.
>
> This is the file handler I'm using now:
> [XFH-DEFAULT]
> STRIPSPACE=OFF
> INSERTNULL=OFF
> EXPANDTAB=OFF
>
> AIX 5.3, Microfocus Server Express 5.0


From: taoxianfeng on
On Jul 25, 6:42 pm, "William M. Klein" <wmkl...(a)nospam.netcom.com>
wrote:
> OK,  I think I understand the "desire".  You want to use X"0A" but *not* X"0D0A"
> as the record delimiter for line sequential files.  (Something that is
> "operating system" and/or application dependent).  Your desire is to be able to
> have X"0D" *data* in LINE SEQUENTIAL files.
>
> From a "usually reliable source" Micro Focus *does* support (allow) this.  The
> following is the solution that I was provided:
>  ***
> "File Handler configuration option LSRECDELIM set in EXTFH.CFG can be used to
> set the record delimiter used for LSEQ files.
>
> Syntax:
>
> LSRECDELIM=[0A|0D0A]
>
> Parameters:
>
> 0A The hexadecimal character x"0A" is used as the record delimiter for line
> sequential files.
>
> 0D0A The hexadecimal characters x"0D0A" are used as the record delimiter for
> line sequential files."
>
> --
> Bill Klein
>  wmklein <at> ix.netcom.com<taoxianf...(a)gmail.com> wrote in message
>
> news:75979a92-6155-4583-9cf4-c80425d1b015(a)v39g2000pro.googlegroups.com...
>
>
>
> > Hi all
>
> > I'm writing a batch source to match 2 input files which is exported
> > from AIX DB2 giving the matched records.
>
> > All other characters are going well except X'0D':all of them get lost
> > when reading the input files into the program. I tried many file
> > handler options and runtime switches but no one worked. Any advice is
> > appreaciated. Thanks in advance!
>
> > Line sequential file, variable-length record.
>
> > This is the file handler I'm using now:
> > [XFH-DEFAULT]
> > STRIPSPACE=OFF
> > INSERTNULL=OFF
> > EXPANDTAB=OFF
>
> > AIX 5.3, Microfocus Server Express 5.0- Hide quoted text -
>
> - Show quoted text -

Thanks for you advice. But I tried it and the result is the same. I
think the LSRECDELIM option just affect the record delimiter (0A or
0D0A) but failed to change something for a single 0D.
From: taoxianfeng on
On Jul 26, 9:11 am, Robert <n...(a)e.mail> wrote:
> On Thu, 24 Jul 2008 23:27:52 -0700 (PDT), taoxianf...(a)gmail.com wrote:
> >On Jul 25, 1:05 pm, Robert <n...(a)e.mail> wrote:
> >> On Thu, 24 Jul 2008 18:34:40 -0700 (PDT), taoxianf...(a)gmail.com wrote:
> >> >I don't agree.Isn't line sequential file delimited by X'0A'?
>
> >> The operating system, not Cobol, specifies the line terminator. AIX and other Unix use
> >> x'0D'. Old Macs (OS9) used 0A. Windows uses 0D0A.
>
> >> A FILE is delimited by its size (in the directory), not by a character.. If your textbook
> >> says a file is terminated by 0A or 1A, it is 25 years out of date.
>
> >Well...seems I failed to address it clearly.Let's read MY code:
>
> >     SELECT INFILE1
> >     ORGANIZATION IS LINE SEQUENTIAL
> >     ASSIGN TO EXTERNAL INFILE1.
>
> >     FD INFILE1
> >     DATA RECORD IS IN-REC1
> >     RECORDING MODE V
> >     RECORD IS VARYING IN SIZE FROM 1 TO 5000
> >     DEPENDING ON WK-INREC1-LEN
> >     BLOCK CONTAINS 0.
> >     01  IN-REC1                      PIC X(5000).
> >…………
> >      01  WK-INREC1-LEN               PIC  9(008).
>
> Most of those FD clauses are superfluous for LINE SEQUENTIAL. You should have written
> FD INFILE1 RECORD VARYING FROM 1 TO 5000 DEPENDING ON WK-INREC1-LEN.
>
> BLOCK CONTAINS 0 is a silly mainframeism.
>
> >1. The RECORD LENGTH will be stored into the WK-INREC1-LEN variable
> >automatically when executing "READ INFILE1" each time. And, believe
> >or
> >not, it's decided by X'0A' like that(the input read counter also
> >proves it):
>
> >1 dot for 1 byte;0D for 1 byte
> >......0D.....0A       (record length:12)
> >...0D......0D....0A   (record length:14)
> >I know the rest of IN-REC1 is filled by space (or nothing if using
> >SPACEFILL=OFF); I also know the method of searching for the 1st non-
> >space reading from right to left. BUT I DON'T NEED THEM since I have
> >no problem about the length of each record.
>
> I'm happy to see you took Richard's suggestion.
>
> >2.The doc I referred to is saying "The record delimiter, which is the
> >line feed (x"0A") character". I didn't mean file delimiter(EOF,X'1A'
> >or something else) either.
>
> >I'm just talking about RECORD DELIMITER or LINE DELIMITER and
> >doubting
> >your "AIX and other Unix use x'0D'".
>
> You are correct; I got them backwards. 0A is Unix, 0D is Mac.
>
>
>
>
>
> >3.Take the example again, my ESSENTIAL QUESTION is ALL X'0D' WERE
> >LOST
> >LIKE THIS:
> >input file:
> >......0D.....0A
> >...0D......0D....0A
>
> >output file:
> >...........0A
> >.............0A
>
> >IF, the record is delimited with X'0D' as you said, then how can I
> >get
> >it in the output file since it exists in the input file?
>
> The reasons are:
>
> 1. Characters less than x'20' (space) are Control Characters, not data.
>     They are instructions to the file system.
> 2. Due to non-standardization, most file systems are generalized to handle formats from
> other operating systems. Most Unix programs, with the notable exception of vi, can read
> Windows files terminated by 0D0A. Most Windows programs can read Unix-style files
> terminated by 0A.
>
> The discarding of your 0Ds is a side-effect of that generalization.
>
> This assignment appears to be a 'trick question' to teach you that different operating
> systems use different standards.
>
> Now let's look at solutions. Bill Klein showed how to specialize the Micro Focus file
> system to recognize only 0A. That's specific to Micro Focus, not Cobol. A Unix flavored
> solution would be to run the input file through the 'tr' program before piping it into
> your Cobol program, like this:
>
> cat INFILE1 | tr "\r| "\v" | yourcobol | tr "\v" "\r" > OUTFILE1
>
> Confusing, right? It is translating 0D (Ctrl-M = return) into 0B (Ctrl-K = vertical tab)
> before your program and translating it back after.
>
> My suggestion to parse lines yourself, recognizing only 0A, is pure Cobol.. It will work
> with any compiler, on any machine.  To handle the last sector on Micro Focus,
>
> 1. Initialize the record area to low-values (binary zeros)
> 2. Read
> 3. If return-code - '92'   *> short record
>        remember you are at end of file
>       search backward for the first non-low-value to get sector length- Hide quoted text -
>
> - Show quoted text -- Hide quoted text -
>
> - Show quoted text -


I have thought of transforming the data with shell at the beginning of
this assignment. But as I said before, I'm restricted to handle it
with in the cobol source. Maybe I should try to persuade my boss since
it would be easier with some shell script.

About parsing the line by myself, I agree that it's a "simple and
stupid" approach which fit for most situations. I will take this.

Thank you very much.
From: William M. Klein on


--
Bill Klein
wmklein <at> ix.netcom.com
<taoxianfeng(a)gmail.com> wrote in message
news:c6cb331a-8e7d-493a-8d3b-872e94b2c6fd(a)j7g2000prm.googlegroups.com...
On Jul 25, 6:42 pm, "William M. Klein" <wmkl...(a)nospam.netcom.com>
wrote:
> OK, I think I understand the "desire". You want to use X"0A" but *not* X"0D0A"
> as the record delimiter for line sequential files. (Something that is
> "operating system" and/or application dependent). Your desire is to be able to
> have X"0D" *data* in LINE SEQUENTIAL files.
>
> From a "usually reliable source" Micro Focus *does* support (allow) this. The
> following is the solution that I was provided:
> ***
> "File Handler configuration option LSRECDELIM set in EXTFH.CFG can be used to
> set the record delimiter used for LSEQ files.
>
> Syntax:
>
> LSRECDELIM=[0A|0D0A]
>
> Parameters:
>
> 0A The hexadecimal character x"0A" is used as the record delimiter for line
> sequential files.
>
> 0D0A The hexadecimal characters x"0D0A" are used as the record delimiter for
> line sequential files."
>
> --
> Bill Klein
> wmklein <at> ix.netcom.com<taoxianf...(a)gmail.com> wrote in message
>
> news:75979a92-6155-4583-9cf4-c80425d1b015(a)v39g2000pro.googlegroups.com...
>
>
>
> > Hi all
>
> > I'm writing a batch source to match 2 input files which is exported
> > from AIX DB2 giving the matched records.
>
> > All other characters are going well except X'0D':all of them get lost
> > when reading the input files into the program. I tried many file
> > handler options and runtime switches but no one worked. Any advice is
> > appreaciated. Thanks in advance!
>
> > Line sequential file, variable-length record.
>
> > This is the file handler I'm using now:
> > [XFH-DEFAULT]
> > STRIPSPACE=OFF
> > INSERTNULL=OFF
> > EXPANDTAB=OFF
>
> > AIX 5.3, Microfocus Server Express 5.0- Hide quoted text -
>
> - Show quoted text -

Thanks for you advice. But I tried it and the result is the same. I
think the LSRECDELIM option just affect the record delimiter (0A or
0D0A) but failed to change something for a single 0D.


From: William M. Klein on
I think the additional information that you need was in another note that I
received which states,

" ...the information you are after is there but hidden away in the
documentation. The File Handler configuration option INSERTNULL allows any
character to be added to a line sequential file by adding a null character
before each character less than x"20". These then get stripped out on the read.
Again this is not documented fully in the INSERTNULL documentation but is in the
documentation for the "N run-time switch"

Therefore, it seems that a READ (with MF and Line Sequential) will ALWAYS "strip
away" characters < X"20".

--
Bill Klein
wmklein <at> ix.netcom.com
<taoxianfeng(a)gmail.com> wrote in message
news:c6cb331a-8e7d-493a-8d3b-872e94b2c6fd(a)j7g2000prm.googlegroups.com...
On Jul 25, 6:42 pm, "William M. Klein" <wmkl...(a)nospam.netcom.com>
wrote:
> OK, I think I understand the "desire". You want to use X"0A" but *not* X"0D0A"
> as the record delimiter for line sequential files. (Something that is
> "operating system" and/or application dependent). Your desire is to be able to
> have X"0D" *data* in LINE SEQUENTIAL files.
>
> From a "usually reliable source" Micro Focus *does* support (allow) this. The
> following is the solution that I was provided:
> ***
> "File Handler configuration option LSRECDELIM set in EXTFH.CFG can be used to
> set the record delimiter used for LSEQ files.
>
> Syntax:
>
> LSRECDELIM=[0A|0D0A]
>
> Parameters:
>
> 0A The hexadecimal character x"0A" is used as the record delimiter for line
> sequential files.
>
> 0D0A The hexadecimal characters x"0D0A" are used as the record delimiter for
> line sequential files."
>
> --
> Bill Klein
> wmklein <at> ix.netcom.com<taoxianf...(a)gmail.com> wrote in message
>
> news:75979a92-6155-4583-9cf4-c80425d1b015(a)v39g2000pro.googlegroups.com...
>
>
>
> > Hi all
>
> > I'm writing a batch source to match 2 input files which is exported
> > from AIX DB2 giving the matched records.
>
> > All other characters are going well except X'0D':all of them get lost
> > when reading the input files into the program. I tried many file
> > handler options and runtime switches but no one worked. Any advice is
> > appreaciated. Thanks in advance!
>
> > Line sequential file, variable-length record.
>
> > This is the file handler I'm using now:
> > [XFH-DEFAULT]
> > STRIPSPACE=OFF
> > INSERTNULL=OFF
> > EXPANDTAB=OFF
>
> > AIX 5.3, Microfocus Server Express 5.0- Hide quoted text -
>
> - Show quoted text -

Thanks for you advice. But I tried it and the result is the same. I
think the LSRECDELIM option just affect the record delimiter (0A or
0D0A) but failed to change something for a single 0D.