View previous topic :: View next topic
|
Author |
Message |
Appu
New User
Joined: 26 Apr 2010 Posts: 73 Location: India
|
|
|
|
Hi All,
In C programming language we can set pointers on files using functions like getp and setp. There we can also start reading the file from a pointer value by using setp. Is there any such random read functionality available in PL/1. |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
What did you not understand in the PL/1 manuals? |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
It would help greatly to know what type of file you are talking about reading from PL/I. |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
In what implementation of C are getp and setp library functions?
Note that in the LUW environment, you have "files", unstructured streams of bytes; the onus for making sense of them is entirely on the application programmer. IN MVS, we have "data sets", where a great deal of information is available to the operating system, and it handles many I/O functions, at the (not very high, IMNSHO) price of not allowing incompetent programmers to do stupid things like read half of one record and a quarter of another. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Akatsukami wrote: |
In what implementation of C are getp and setp library functions?
Note that in the LUW environment, you have "files", unstructured streams of bytes; the onus for making sense of them is entirely on the application programmer. IN MVS, we have "data sets", where a great deal of information is available to the operating system, and it handles many I/O functions, at the (not very high, IMNSHO) price of not allowing incompetent programmers to do stupid things like read half of one record and a quarter of another. |
Ah, C and C++ are LE languages. I'm afraid you can do this in z/OS as well (now). Plenty of other little "trip me, please"s as well, like trying to do it with a PS which has been MODded. |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
Bill Woodger wrote: |
Akatsukami wrote: |
In what implementation of C are getp and setp library functions?
Note that in the LUW environment, you have "files", unstructured streams of bytes; the onus for making sense of them is entirely on the application programmer. IN MVS, we have "data sets", where a great deal of information is available to the operating system, and it handles many I/O functions, at the (not very high, IMNSHO) price of not allowing incompetent programmers to do stupid things like read half of one record and a quarter of another. |
Ah, C and C++ are LE languages. I'm afraid you can do this in z/OS as well (now). Plenty of other little "trip me, please"s as well, like trying to do it with a PS which has been MODded. |
You could certainly always do this in Assembler, and I'm sure that software engineers just learning the language have so baked the dog on numerous occasions. But in z/OS C/C++, I don't believe that an MVS data set can be opened as a stream, which would be necessary to do this. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
But the fine manual states:
Quote: |
When you specify this parameter and open a file in binary mode, all repositioning functions (such as fseek() and ftell()) use relative byte offsets from the beginning of the file instead of encoded offsets. |
(Emphasis added.)
Again, I don't believe that an MVS data set can be opened in binary mode (a Unix file, yes, but who cares about Unix? ) |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
z/OS V1R11.0 XL C/C++ Run-Time Library Reference z/OS V1R10.0-V1R11.0 on fopen.
I know there's more, but I'm not going to look. I was researching RECFM=FS/FBS, which someone thought improved IO times on batch files (it doesn't), but when doing a C/C++ access to a specific starting byte in a file, FS/FBS allows a calculation to find it, whereas F/FB reads from the start of the file each time it is necessary (counting the bytes) which is where the "performance" confusion arose.
Effectively the same as is able to be done in Assembler, but more accessible to Software Engineers from non-Mainframe backgrounds to enable them to grind a CPU into the dust to "fix up" their code, because they can't design a program :-) |
|
Back to top |
|
|
|