- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- Re: Getting block size of a data file, from within...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-18-2006 05:05 AM
тАО09-18-2006 05:05 AM
Re: Getting block size of a data file, from within COBOL.
for many visitors in this forum, (those behind a strict ruled firewall, and those running M$ systems, others maybe) it is impossible, or impracticle, if teh appended text is anything else as ".TXT"
For future postings, please rename the file accordingly.
Thanks in advance.
Proost.
Have one on me.
jpe
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-18-2006 05:30 AM
тАО09-18-2006 05:30 AM
Re: Getting block size of a data file, from within COBOL.
Sorry,I did not know about that.
Here is the .COB again renamed as .txt :)
Pallavi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-18-2006 07:19 AM
тАО09-18-2006 07:19 AM
Re: Getting block size of a data file, from within COBOL.
Welcome to the OpenVMS Forum.
Always good to see new names!
Unfortunately there are several issues with your proposed solution.
Most importantly a spawned process has its own symbol space which is not visible to the parent. You would have to define a LOGICAL, not a symbol, in the JOB table to get information from child to parent.
Actually... if you only need to return 1 integer value you can 'cheat' and return it as the status.
Minor problems
- diplay : typo
- moving spaces in command after setting text.
- command file need := to for string asssignment
- f$file: Why pass string with expanded variable if you can just pass the variable:
...f$file (file, "eof")
(Answer: because you want to see the text with 'set verify')
Try the following. It 'encodes' the size into a status to make it look succesful and have to OPTION (not done here) to detect failure.
$ type detsize.com
$FILE := tmp.exe
$FILE_SIZE == F$FILE_ATTRIBUTES("''FILE'","EOF")
$exit 2*file_size + 1
$Type test.cob
IDENTIFICATION DIVISION.
PROGRAM-ID. DETSIZE.
AUTHOR. PALLAVI.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
I-O-CONTROL.
DATA DIVISION.
FILE SECTION.
WORKING-STORAGE SECTION.
01 SUBMIT-COMMAND PIC X(100).
01 FILE-SIZE PIC 9(9).
01 stat pic s9(9) comp.
PROCEDURE DIVISION.
MAINLINE.
MOVE SPACES TO SUBMIT-COMMAND.
STRING "@DETSIZE" DELIMITED BY SIZE
INTO SUBMIT-COMMAND.
CALL "LIB$SPAWN" USING BY DESCRIPTOR SUBMIT-COMMAND,
omitted,omitted,omitted,omitted,omitted, by reference stat.
subtract 1 from stat.
divide stat by 2 giving FILE-SIZE.
DISPLAY "--------- \ \ \ \ \ / / / /________".
DISPLAY "THE FILE SIZE IS:::" FILE-SIZE.
MAINLINE-EXIT.
EXIT.
(I needed cobol/ansi due to tab/spaces/whatever).
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-18-2006 08:24 PM
тАО09-18-2006 08:24 PM
Re: Getting block size of a data file, from within COBOL.
Please ignore the typos (last min attaching of wrong file) But, thanks for elaborating on why we can't read the symbol back into the cob with lib$get_symbol.
But I did not get why we needed to do the
$exit 2*file_size + 1
Could we not have done it as
$exit file_size ?
Regards,
Pallavi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-18-2006 09:16 PM
тАО09-18-2006 09:16 PM
Re: Getting block size of a data file, from within COBOL.
In VMS odd exit status values indicate success, even indicate a problem.
If the tool simply used the files size as exit, then how can it indicate a problem (for example: file-not-found)?
Looking at it from the other side, what if the file size is even (for example 12). Try it...
$ exit 12
%SYSTEM-F-ACCVIO, access violation,
That would be rather confusing no?
Did the process die a horrible death or was the size 12? Knowing that it is not a C program, but a DCL script and ACCVIO is very unlikely, so we 'guess' it is a size?
Now $exit 25 --> silence.
Cheers,
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-21-2006 07:21 AM
тАО09-21-2006 07:21 AM
Re: Getting block size of a data file, from within COBOL.
- « Previous
-
- 1
- 2
- Next »