Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Read and Write unknown record length? MVS
Environment: IBM Mainframe, MVS.

How do I read a fixed length file of unknown record length into a data area
sized to the maximum expected record length? It would appear from my
research that I need to code RECORDING MODE IS U and possibly RECORD
CONTAINS 0. But, quoting from COBOL MVS & VM V1R2M2 Programming Guide: "If
you use the RECORD CONTAINS integer clause (RECORD Clause Format 1), the
record length is the integer value, regardless of the lengths of the
level-01 record description entries associated with the file." Surely that
statement is not true when integer equals 0, but I can find no other
description for that case.

If I can get a successful read, is there any way to determine what the
actual record length was? Can any of the experts give me the FD and READ
statements to handle this?

How about a simple program that reads a file of unknown record length (up
to some maximun of, say, 3000 bytes) and writes an exact copy, using the
record length from the input file. Can you include the JCL DD statements
for input and output files?




Report this thread to moderator Post Follow-up to this message
Old Post
William Bub
02-10-05 01:55 AM


Re: Read and Write unknown record length? MVS
COBOL (IBM or otherwise - unless using some specific operating system
"extensions") is NOT very good at reading files for which you do NOT know th
e
"fixed file attributes" at compile-time.  (See file status = 39).

It sounds to me as if you might be better

A) using some IBM utility to do what you want

B) using ISPF library services (which can be accessed from within a COBOL
program).  See:
:
http://publibz.boulder.ibm.com/cgi-.../ISPZSG30/1.5.3

and related information - for example,
http://publibz.boulder.ibm.com/cgi-...spzsg30/1.3.3.9



--
Bill Klein
wmklein <at> ix.netcom.com
"William Bub" <fathafluff@hotmail.com> wrote in message
news:RBwOd.29278$8H2.27506@twister.nyroc.rr.com...
> Environment: IBM Mainframe, MVS.
>
> How do I read a fixed length file of unknown record length into a data are
a
> sized to the maximum expected record length? It would appear from my
> research that I need to code RECORDING MODE IS U and possibly RECORD
> CONTAINS 0. But, quoting from COBOL MVS & VM V1R2M2 Programming Guide: "If
> you use the RECORD CONTAINS integer clause (RECORD Clause Format 1), the
> record length is the integer value, regardless of the lengths of the
> level-01 record description entries associated with the file." Surely that
> statement is not true when integer equals 0, but I can find no other
> description for that case.
>
> If I can get a successful read, is there any way to determine what the
> actual record length was? Can any of the experts give me the FD and READ
> statements to handle this?
>
> How about a simple program that reads a file of unknown record length (up
> to some maximun of, say, 3000 bytes) and writes an exact copy, using the
> record length from the input file. Can you include the JCL DD statements
> for input and output files?
>
>
>



Report this thread to moderator Post Follow-up to this message
Old Post
William M. Klein
02-10-05 01:55 AM


Re: Read and Write unknown record length? MVS
Thanks. That wasn't too helpful    :)  (but probably accurate). Actually, I
was trying to write a stripped version of IEBPTPCH in COBOL, to run on a
Microfocus developement platform, since they don't seem to have an emulator
for that utility. Some of our runstreams use it, and I wanted to be able to
run the whole runstream.

"William M. Klein" <wmklein@nospam.netcom.com> wrote in message
news:aMwOd.1643162$f47.283144@news.easynews.com...
> COBOL (IBM or otherwise - unless using some specific operating system
> "extensions") is NOT very good at reading files for which you do NOT know
the
> "fixed file attributes" at compile-time.  (See file status = 39).
>
> It sounds to me as if you might be better
>
> A) using some IBM utility to do what you want
>
> B) using ISPF library services (which can be accessed from within a COBOL
> program).  See:
> :
>
http://publibz.boulder.ibm.com/cgi-.../ISPZSG30/1.5.3
>
> and related information - for example,
>
http://publibz.boulder.ibm.com/cgi-...spzsg30/1.3.3.9
>
>
>
> --
> Bill Klein
>  wmklein <at> ix.netcom.com
> "William Bub" <fathafluff@hotmail.com> wrote in message
> news:RBwOd.29278$8H2.27506@twister.nyroc.rr.com... 
area 
"If 
that 
(up 
>
>



Report this thread to moderator Post Follow-up to this message
Old Post
William Bub
02-10-05 01:55 AM


Re: Read and Write unknown record length? MVS
You _could_ write a program for the IBM mainframe which uses RECORD 0 (I
have done so), but that is dependent on the operating system and
compiler you are using.  It isn't part of the ANSI / ISO COBOL spec, but
rather an IBM extension.  The operating system supplies the record size
(LRECL) to the Data Control Block (DCB) at open time, if the program
leaves it unspecified.  (Sorry, but I do not recall the details of how I
got my program to process different record sizes.)

You say that your real target is a Windows op sys, not z/OS (or OS/390,
or MVS).  I have never tried to write such a program for the PC, and I
have old MF Language Reference manuals that do not seem to allow the use
of "0" as the integer.  I don't think Windows is going to provide you
with a record size, either.

In addition to these problems, your data may or may not be like it was
on the mainframe.  You could use MF utilities to create what MF calls an
ORGANIZATION RECORD SEQUENTIAL file, or the data might get downloaded
such that it becomes ORGANIZATION LINE SEQUENTIAL (delimited by the
CR-LF characters).

You may want to look at what is being done in IEBPTPCH (some sort of
rather simple data transformation, I expect), and add code to the COBOL
programs which write the file that becomes input to IEBPTPCH, to
duplicate what the utility is doing.  That is, when you are ready to
write the existing output file, call a subroutine that writes the output
that IEBPTPCH would write back on the host.  This would be more
efficient, since you are working with the records in memory.

Or, if you don't want to touch the COBOL programs, you could write a
series of simple new COBOL programs that duplicate the IEBPTPCH
functions (record selection, reformatting, etc.)
====
William Bub wrote:

>Thanks. That wasn't too helpful    :)  (but probably accurate). Actually, I
>was trying to write a stripped version of IEBPTPCH in COBOL, to run on a
>Microfocus developement platform, since they don't seem to have an emulator
>for that utility. Some of our runstreams use it, and I wanted to be able to
>run the whole runstream.
>
>"William M. Klein" <wmklein@nospam.netcom.com> wrote in message
>news:aMwOd.1643162$f47.283144@news.easynews.com...
>
> 
>the
>
> 
>http://publibz.boulder.ibm.com/cgi-.../ISPZSG30/1.5.3
>
> 
>http://publibz.boulder.ibm.com/cgi-...spzsg30/1.3.3.9
>
> 
>area
>
> 
>"If
>
> 
>that
>
> 
>(up
>
> 


Report this thread to moderator Post Follow-up to this message
Old Post
Colin Campbell
02-10-05 08:55 AM


Re: Read and Write unknown record length? MVS
<snip>
> Or, if you don't want to touch the COBOL programs, you could write a
> series of simple new COBOL programs that duplicate the IEBPTPCH
> functions (record selection, reformatting, etc.)

This is what I'm trying to do, but IEBPTPCH will use any record length. The
MicroFocus we are using is supposed to emulate the mainframe, and seems to
do it quite well. It has emulaters for DFSORT, IEBGENER, ICKEFT01, etc. (but
not IEBPTPCH). It uses a file catalog with all of the file attributes known
to the mainframe. And it runs JCL and expands PROCs like MVS does. My hope
was to write a program called IEBPTPCH so that we could run (for testing)
with the same JCL and PROCs already in use on the mainframe.



Report this thread to moderator Post Follow-up to this message
Old Post
William Bub
02-10-05 08:55 AM


Re: Read and Write unknown record length? MVS
As was said by Mssrs Klein & Campbell, you are trying to do something
that COBOL is really not good at. I could go into a long explanation of
how the IBM utilities are written (in ALC or PL/X or PL/AS or PL/S),
how disk I/O differs between FBA & CKD, etc. ad nausem.

What you want to do is kind of emulate the behavior of the IBM utility.
Depending on what the real function is you are after you may be able to
use DOS commands (PRINT and COPY) to achieve the same results.

Regards,
Steve.T


Report this thread to moderator Post Follow-up to this message
Old Post
Steve.T
02-10-05 08:55 AM


Re: Read and Write unknown record length? MVS
As long as your target is Micro Focus and *NOT* IBM, then you can work with
"undefined" record lengths (if you really want to do this yourself in COBOL)
.

Check out information on the FCDREG  compiler option and accessing the FCD
(dynamically) from within your Micro Focus program.

I found information on it in

"File Handling > 7. Callable File Handler and Callable Sort APIs" in the Net
Express 4.0 documentation (available online)

Again, if you code using this, it work with Micro Focus but NOT on the IBM
mainframe.  (On the mainframe, you CAN accesss the DCB of a QSAM file by doi
ng a
CALL using FD-name but this won't really provide what I think you want)

Alternatively. contact Micro Focus - MFEEE already includes IDCAMS and IEBDG
support, so they MIGHT be interested in providing PTPCH support as well.

--
Bill Klein
wmklein <at> ix.netcom.com
"William Bub" <fathafluff@hotmail.com> wrote in message
news:sSzOd.29348$8H2.4855@twister.nyroc.rr.com...
> <snip> 
>
> This is what I'm trying to do, but IEBPTPCH will use any record length. Th
e
> MicroFocus we are using is supposed to emulate the mainframe, and seems to
> do it quite well. It has emulaters for DFSORT, IEBGENER, ICKEFT01, etc. (b
ut
> not IEBPTPCH). It uses a file catalog with all of the file attributes know
n
> to the mainframe. And it runs JCL and expands PROCs like MVS does. My hope
> was to write a program called IEBPTPCH so that we could run (for testing)
> with the same JCL and PROCs already in use on the mainframe.
>
>



Report this thread to moderator Post Follow-up to this message
Old Post
William M. Klein
02-10-05 08:55 AM


Re: Read and Write unknown record length? MVS
William M. Klein wrote:
> As long as your target is Micro Focus and *NOT* IBM, then you can work wit
h
> "undefined" record lengths (if you really want to do this yourself in COBO
L).
>
> Check out information on the FCDREG  compiler option and accessing the FCD
> (dynamically) from within your Micro Focus program.
>
> I found information on it in
>
> "File Handling > 7. Callable File Handler and Callable Sort APIs" in the N
et
> Express 4.0 documentation (available online)
>
> Again, if you code using this, it work with Micro Focus but NOT on the IBM
> mainframe.  (On the mainframe, you CAN accesss the DCB of a QSAM file by d
oing a
> CALL using FD-name but this won't really provide what I think you want)
>
> Alternatively. contact Micro Focus - MFEEE already includes IDCAMS and IEB
DG
> support, so they MIGHT be interested in providing PTPCH support as well.
>
William B, (as opposed to Bill K).

If you follow the above and DO it on a PC, Micro Focus, (back in DOS
days), authored a Byte Stream file program. This allows you to read a
file in 'chunks', or subject to memory the whole file. Apart from the
ability to read in, then you are on your own to browse the input data
and determine what you want to do with it.

If you want to give this a 'suck it and see' - e-mail me, ('editing' my
address), and I'll send two versions from M/F which are Byteio.cbl and
cblwritefile.cbl. These examples expand on the text of "Chapter 7 - File
Handling", mentioned by Bill K. above.

Jimmy, Calgary AB


Report this thread to moderator Post Follow-up to this message
Old Post
James J. Gavan
02-10-05 08:55 AM


Re: Read and Write unknown record length? MVS
This is a MicroFocus IBM developement platform. It tries to emulate a
mainframe environment. It has a catalog like a mainframe. It handles files
like a mainframe. I believe if I can come up with a way which would work on
the mainframe, it should work on the MicroFocus platform. As I stated
earlier, it runs IBM JCL and PROCs. So I am looking for an answer for an IBM
mainframe. If that won't run on MicroFocus, they have a problem.


"James J. Gavan" <jgavandeletethis@shaw.ca> wrote in message
news:CGDOd.348904$8l.5280@pd7tw1no...
> William M. Klein wrote: 
with 
COBOL). 
FCD 
Net 
IBM 
doing a 
IEBDG 
> William B, (as opposed to Bill K).
>
> If you follow the above and DO it on a PC, Micro Focus, (back in DOS
> days), authored a Byte Stream file program. This allows you to read a
> file in 'chunks', or subject to memory the whole file. Apart from the
> ability to read in, then you are on your own to browse the input data
> and determine what you want to do with it.
>
> If you want to give this a 'suck it and see' - e-mail me, ('editing' my
> address), and I'll send two versions from M/F which are Byteio.cbl and
> cblwritefile.cbl. These examples expand on the text of "Chapter 7 - File
> Handling", mentioned by Bill K. above.
>
> Jimmy, Calgary AB
>



Report this thread to moderator Post Follow-up to this message
Old Post
William Bub
02-10-05 08:55 PM


Re: Read and Write unknown record length? MVS
Have you looked at the Mainframe Express, Enterprise Edition LRM under
"Recording Mode"?
(http://supportline.microfocus.com/s...ndx.h
tm)

It clearly (?) states for RECORDING MODE phrase

"The "U" option is documentary only. "

P.S.  My "usually reliable" source at MF (like Jimmy in this forum) suggeste
d
that you post your question in the Micro Focus forum (AnswerLab) and see if
anyone else has an IEBPTPCH solution.

Although I suspect that MF would take "enhancement requests" for missing IBM
compatibility issues, there is certainly NO claim that MFEEE is currently
*identical* to the IBM mainframe.  (For example, also in FD, BLOCK CONTAINS 
is
also documentary)

--
Bill Klein
wmklein <at> ix.netcom.com
"William Bub" <fathafluff@hotmail.com> wrote in message
news:b8JOd.3545$Eq6.3537@twister.nyroc.rr.com...
> This is a MicroFocus IBM developement platform. It tries to emulate a
> mainframe environment. It has a catalog like a mainframe. It handles files
> like a mainframe. I believe if I can come up with a way which would work o
n
> the mainframe, it should work on the MicroFocus platform. As I stated
> earlier, it runs IBM JCL and PROCs. So I am looking for an answer for an I
BM
> mainframe. If that won't run on MicroFocus, they have a problem.
>
>
> "James J. Gavan" <jgavandeletethis@shaw.ca> wrote in message
> news:CGDOd.348904$8l.5280@pd7tw1no... 
> with 
> COBOL). 
> FCD 
> Net 
> IBM 
> doing a 
> IEBDG 
>
>



Report this thread to moderator Post Follow-up to this message
Old Post
William M. Klein
02-10-05 08:55 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Cobol archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 05:53 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.