HP3000-L Archives

May 2002, Week 1

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Ken Hirsch <[log in to unmask]>
Reply To:
Ken Hirsch <[log in to unmask]>
Date:
Sun, 5 May 2002 06:41:45 -0400
Content-Type:
text/plain
Parts/Attachments:
text/plain (79 lines)
From: "Mary DeGallo" <[log in to unmask]>
>    My COBOL code just recieves a BLOB of DATA (BUFFER)
>
>    and based on the type (identified by the first 4
>    bytes)  I have to write the data in different
> record
>    structures.
>
>    If TYPE = AAAA   Record Length of 100 bytes.
>    If TYPE = BBBB   Record Length of 125 bytes.
>    If TYPE = CCCC   Record Length of 150 bytes.
>
>    The TYPES and their CORRESPONDING RECORD LENGTHS
>     have to be parameterised.  So are dynamic.
>
>   The solution, we are working on is  INTRINSIC calls.
>   For argument sake we can assume, that the file is
>   already BUILD  and exists.

You can do this in pure COBOL, see e.g. the RECORD VARYING clause of the FD entry.
It may be easier to do it with intrinsics.

>
>   I build files before execution at OS level
>    :  BUILD FILEAAAA;REC=100,,F;Msg
>
>   I am  using following in COBOL code
>     call intrinsic "FOPEN"
>          WS-FILENAME
>          %30105 %2300
>          WS-SOME-FILE-POINTER.
>
>     call instrinsic "FWRITE" ...
>
>  I am facing some error at execution time.
>
> Issue 1:  My build is giving me  a VAM kind of file.
>           I am looking for a FAM.

There is no FAM, but VAM will work just fine.

>
> Issue 2:  At execution, it is not able to do
>           what is required,  and is giving me a
>           STACK error.
>
>     what could the problem be?

It could be a lot of things; you didn't give much information.  For one thing, if
the FOPEN above is verbatim, it's probably wrong.  The fourth parameter to FOPEN is
record length, so I'm guessing you actually want:
     call intrinsic "FOPEN"
          WS-FILENAME
          %30105 %2300
     giving
          WS-SOME-FILE-POINTER.


> Issue 3:  If I can do a intrinsic call  to open
>           and close files, why can I not use
>           instrinsic call to build files. If yes,
>           which one is it?
>

(1) You can issue the build command (or just about any OS command) with the
HPCICOMMAND intrinsic (or the older COMMAND intrinsic).
(2) On the FOPEN, if you specify that the file is new (least significant two bits of
foptions = 0), then the file will be created.  You should include a record length
parameter. The file will not be visible to other programs until it is
closed--FCLOSE( filehandle, 1, 0).
(3) You can open and save with one step using the HPFOPEN intrinsic, the domain (3)
parameter, value 4.

In case nobody has mentioned this, all the manuals are available at
http://docs.hp.com/mpeix/all/index.html

* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *

ATOM RSS1 RSS2