PL/I(MVS) function like fopen() in C ??? 
Author Message
 PL/I(MVS) function like fopen() in C ???

I'm a newbie in PL/I and looking for a equivalent
for the C-Language function fopen() which can open
a dataset like 'PROJECT.GROUP.TYPE(MEMBER)' or
a dd-stmnt. like 'DD:THISDD' or even
a member from a dd-stmnt. like 'DD:THISDD(MEMBER)'.

TIA Frank

Sent via Deja.com http://www.*-*-*.com/
Before you buy.



Fri, 09 Aug 2002 03:00:00 GMT  
 PL/I(MVS) function like fopen() in C ???

Quote:

> I'm a newbie in PL/I and looking for a equivalent
> for the C-Language function fopen() which can open
> a dataset like 'PROJECT.GROUP.TYPE(MEMBER)' or

This is called 'DYNALLOC' and not allowed in PL/I. If you need such a
function, write an ASSEMBLER!

Quote:
> a dd-stmnt. like 'DD:THISDD' or even

Yes, that's the way we do it: OPEN FILE(THISDD) INPUT;
You don't get a file-pointer, the file is open now, that's all.

Quote:
> a member from a dd-stmnt. like 'DD:THISDD(MEMBER)'.

No, does not work in PL/I. See answer to the first question!

Quote:

> TIA Frank

A little sample (you may need the ? sign instead of the ^):

 XXXXX: PROCEDURE OPTIONS (MAIN);
 DCL THISDD FILE;
 DCL MYREC CHAR(80);
 DCL EOF BIT(1) INIT('0'B);
 ON ENDFILE(THISDD) EOF = '1'B;
 OPEN FILE(THISDD) RECORD INPUT;
 READ FILE(THISDD) INTO (MYREC);
 DO WHILE (^EOF);
  PUT SKIP LIST(MYREC);
  READ FILE(THISDD) INTO (MYREC);
 END;
 CLOSE FILE(THISDD);
 RETURN;
 END  XXXXX;
--
Daniel
------------------------------------------------------------
visit us at:
http://www.winterthur.com

Sent via Deja.com http://www.deja.com/
Before you buy.



Fri, 09 Aug 2002 03:00:00 GMT  
 PL/I(MVS) function like fopen() in C ???

Quote:

>I'm a newbie in PL/I and looking for a equivalent
>for the C-Language function fopen() which can open
>a dataset like 'PROJECT.GROUP.TYPE(MEMBER)' or
>a dd-stmnt. like 'DD:THISDD' or even
>a member from a dd-stmnt. like 'DD:THISDD(MEMBER)'.

the only solution, witch I knew, ist to write a assembler
sobroutine witch allocate the dataset via SVC 99.

Regards: Jochen Schmitt



Fri, 09 Aug 2002 03:00:00 GMT  
 PL/I(MVS) function like fopen() in C ???

Quote:

> I'm a newbie in PL/I and looking for a equivalent
> for the C-Language function fopen() which can open
> a dd-stmnt. like 'DD:THISDD' ...

  DECLARE XYZ FILE INPUT;
  OPEN FILE(XYZ) TITLE('THISDD');

How you connect 'THISDD' to a sequential dataset, or to a member of a
partitioned dataset, is an exercise for the reader.  :-)



Fri, 09 Aug 2002 03:00:00 GMT  
 PL/I(MVS) function like fopen() in C ???

Quote:

> ...looking for a equivalent
> for the C-Language function fopen() which can open
> a dataset like 'PROJECT.GROUP.TYPE(MEMBER)' or
> a dd-stmnt. like 'DD:THISDD' or even
> a member from a dd-stmnt. like 'DD:THISDD(MEMBER)'.

Thanks for all the replies.

I already thought that there's no exact functionally
equivalent for what I wanted. The mentioned notes were
ok, but I hoped for a solution without having to code
in Assembler and without having to do the allocate
outside PL/I.
Since I only tried to port an existing/running C-pgm
to PL/I because it seems to me that on the mainframe
more people code in PL/I than in C (if they don't
code in ASM at all), and the wanted functionality is
an elementary functionality, I think, I don't port
this pgm.

But again, thanks to all who replied...        Frank

Sent via Deja.com http://www.deja.com/
Before you buy.



Sat, 10 Aug 2002 03:00:00 GMT  
 PL/I(MVS) function like fopen() in C ???

Quote:



> > ...looking for a equivalent
> > for the C-Language function fopen() which can open
> > a dataset like 'PROJECT.GROUP.TYPE(MEMBER)' or
> > a dd-stmnt. like 'DD:THISDD' or even
> > a member from a dd-stmnt. like 'DD:THISDD(MEMBER)'.

> Thanks for all the replies.

> I already thought that there's no exact functionally
> equivalent for what I wanted. The mentioned notes were
> ok, but I hoped for a solution without having to code
> in Assembler and without having to do the allocate
> outside PL/I.
> Since I only tried to port an existing/running C-pgm
> to PL/I because it seems to me that on the mainframe
> more people code in PL/I than in C (if they don't
> code in ASM at all), and the wanted functionality is
> an elementary functionality, I think, I don't port
> this pgm.

That's the problem.  It isn't an elementary functionality in MVS.  MVS
uses DD's.  SVC 99 was a long time coming, and still doesn't sit
altogether comfortably in the system.  That MVS C uses it is only due to
it being the universal interpretation of C, which is due in turn to C's
being so closely married to Unix.  Every non-Unix C compiler has to go
out of its way to make the environment it's running in look like Unix,
so that C programs can work.

That being said, it isn't terribly difficult to write a minimal SVC 99
routine in assembler.

Also, I wonder whether the new PL/I compiler and LE might not handle it.

--
-John W. Kennedy

Compact is becoming contract
Man only earns and pays.  -- Charles Williams



Sat, 10 Aug 2002 03:00:00 GMT  
 PL/I(MVS) function like fopen() in C ???


Quote:



>> > ...looking for a equivalent
>> > for the C-Language function fopen() which can open
>> > a dataset like 'PROJECT.GROUP.TYPE(MEMBER)' or
>> > a dd-stmnt. like 'DD:THISDD' or even
>> > a member from a dd-stmnt. like 'DD:THISDD(MEMBER)'.

>> Thanks for all the replies.

>> I already thought that there's no exact functionally
>> equivalent for what I wanted. The mentioned notes were
>> ok, but I hoped for a solution without having to code
>> in Assembler and without having to do the allocate
>> outside PL/I.
>> Since I only tried to port an existing/running C-pgm
>> to PL/I because it seems to me that on the mainframe
>> more people code in PL/I than in C (if they don't
>> code in ASM at all), and the wanted functionality is
>> an elementary functionality, I think, I don't port
>> this pgm.

>That's the problem.  It isn't an elementary functionality in MVS.  MVS
>uses DD's.  SVC 99 was a long time coming, and still doesn't sit
>altogether comfortably in the system.  That MVS C uses it is only due to
>it being the universal interpretation of C, which is due in turn to C's
>being so closely married to Unix.  Every non-Unix C compiler has to go
>out of its way to make the environment it's running in look like Unix,
>so that C programs can work.

>That being said, it isn't terribly difficult to write a minimal SVC 99
>routine in assembler.

>Also, I wonder whether the new PL/I compiler and LE might not handle it.

>--
>-John W. Kennedy

>Compact is becoming contract
>Man only earns and pays.  -- Charles Williams

If the goal is to read DISP=OLD (existing) files and members, then
there is another possibility: RDJFCB and a open exit from the DCB
to point to the JFCB.  One does a RDJFCB, modifies the filename
to suit one's needs, and then does the open.  There is a way to
locate the DCB used by PL/1 and it _ought_ (famous last words) to
be still modifiable in this manner.

It has been fully 2 decades since I last did either SVC 99's or
RDJFCB macros.  But, as I remember they were not particularly
difficult to write.


Mail Stop 318, Fermilab, Kirk & Pine Rds., PO Box 500, Batavia, IL 60510-0500,
USA.  (Speaking for myself and not for US, US DOE, FNAL nor URA.)  (Product,
trade, or service marks herein belong to their respective owners.)



Sat, 10 Aug 2002 03:00:00 GMT  
 PL/I(MVS) function like fopen() in C ???
Franklin Denblatt writes ...

Quote:

>I already thought that there's no exact functionally
>equivalent for what I wanted. The mentioned notes were
>ok, but I hoped for a solution without having to code
>in Assembler and without having to do the allocate
>outside PL/I.
>Since I only tried to port an existing/running C-pgm
>to PL/I because it seems to me that on the mainframe
>more people code in PL/I than in C (if they don't
>code in ASM at all), and the wanted functionality is
>an elementary functionality, I think, I don't port
>this pgm.

First, you can call C functions from the new PL/I compilers.

Second, people do still code in Assembler (ask the airlines).

Third, I'm not sure that more people code in PL/I than C on the mainframe. The
acceptance of C seems to be growing (ugh) and the acceptance of PL/I seems to
be declining.

Fourth, you can call TSO commands, such as ALLOCATE, from Assembler, PL/I, C,
and even COBOL.

Fifth, I don't feel that this "functionality" is all that elementary, or even
necessary in many applications.

Regards,

Steve Comstock
Telephone: 303-393-8716
www.trainersfriend.com

256-B S. Monaco Parkway
Denver, CO 80224
USA



Sun, 11 Aug 2002 03:00:00 GMT  
 PL/I(MVS) function like fopen() in C ???

Quote:

> If the goal is to read DISP=OLD (existing) files and members, then
> there is another possibility: RDJFCB and a open exit from the DCB
> to point to the JFCB.  One does a RDJFCB, modifies the filename
> to suit one's needs, and then does the open.  There is a way to
> locate the DCB used by PL/1 and it _ought_ (famous last words) to
> be still modifiable in this manner.

I do this all the time with PL/I for MVS&VM (and before that with PL/I
2.3).  I'd be happy to send you the assembler if you want.


Sun, 11 Aug 2002 03:00:00 GMT  
 PL/I(MVS) function like fopen() in C ???



Quote:
> Also, I wonder whether the new PL/I compiler and LE might not handle it.

It does, same underlying syntax as workstation VA PL/I in the TITLE option.

---

I have generic SVC 99 support that enables you to do most things, plus an
SVC99 "generator" that will create custom SVC99 support routines. Those
interested can apply by e-mail, but the code comes AS IS.

---

My personal recommendation is run your program under TSO, and use code such
as:

   DCL TSOLNK ENTRY
              (FIXED BIN (31),     /* FLAGS - 00010001'BX             */
               CHAR (*),           /* TSO COMMAND, CLIST OR EXEC CALL */
               FIXED BIN (31),     /* LENGTH (COMMAND)                */
               FIXED BIN (31),     /* RETURN CODE FROM COMMAND, ETC.  */
               FIXED BIN (31),     /* REASON CODE                     */
               FIXED BIN (31))     /* ABEND CODE                      */
              OPTIONS (ASM INTER RETCODE);

   DCL TSOFLAGS   FIXED BIN (31):

   FETCH TSOLNK;

   UNSPEC (TSOFLAGS) = '00010001'BX;
   CALL TSOLNK (TSOFLAGS, (CMD), LENGTH (CMD),
                      RETCODE, REASONCODE, ABENDCODE);
   RC = PLIRETV ();

to issue CMD containing a TSO ALLOC statement. That way, you need no
assembler.



Tue, 13 Aug 2002 03:00:00 GMT  
 
 [ 10 post ] 

 Relevant Pages 

1. (MVS) Writing a REXX function in MVS C

2. Clarion C Compiler does not recognizes the Standard C Functions like fopen

3. PL/1 execution in MVS

4. MVS(PL/1) to UNIX(Sybase)

5. MVS VSAM Processing under PL/I

6. MVS PL/I and IEEE

7. Migrating PL/I from MVS to WinNT

8. PL/I - new IBM compiler for MVS ...

9. PL/1 on MVS IBM S/390

10. MVS PL/I Call to REXX

11. Canada Vancouver - PL/1, IMS, DB2, MVS, TSO, ISPF, JCL - Experienced Programmers

12. Canada Vancouver - Programmer PL/1 IMS DB2 MVS - contract job

 

 
Powered by phpBB® Forum Software