HP3000-L Archives

June 2008, Week 4

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:
John Pitman <[log in to unmask]>
Reply To:
John Pitman <[log in to unmask]>
Date:
Thu, 26 Jun 2008 15:58:25 +1000
Content-Type:
text/plain
Parts/Attachments:
text/plain (95 lines)
<Flame suit on >

That's just another Cobol usage discouragement argument. The Intrinsics are not always very friendly. BUT once you have it working, you don't have to learn it all over again, ever.

We did this using CREATE and ACTIVATE 100 years ago in SPL as a subroutine to Basic, now all you need is

10 system x,"RUN PROGRAM.PUB.WORK"

In C its

   pin = 0;
   flags = 1;
   CREATE(child, 0, &pin,0, flags);
   if ( pin == 0)
   {
      printf ("\n\n Error!!!. Program: %s can not be executed.\n\n",child);
   }
   else
   {
         ACTIVATE(pin, 2);
   }
<flame suit off>
jp

-----Original Message-----
From: HP-3000 Systems Discussion [mailto:[log in to unmask]] On Behalf Of Brian Donaldson
Sent: Thursday, 26 June 2008 2:53 PM
To: [log in to unmask]
Subject: Re: [HP3000-L] Return Codes from CREATEPROCESS

I have read everyone's posting on this topic regarding the CREATEPROCESS
monster and I'm sure my response here will invoke a ton of hate mail in my
direction, but here goes anyway.........

This is my -2 cents worth......

The create status field only gives you info on the status of the call to
CREATEPROCESS (as shown in my working storage table in a previous posting
on this topic).

If a programmer wants to see whether the program being run inside the
CREATEPROCESS actually succeeded or not then CREATEPROCESS is
definitely NOT the way to go.

The program (previously being CREATEPROCESSed) should be made into a
subroutine, then called from the program, whereby you can pass error codes,
JCW values etc etc in and out of it until the cows come home. That way you
will always know what happened within the program being CALLed.
I do it this way *all* of the time.

Recently, I got involved in doing some work with CREATEPROCESS when I was
trying to help Walter out with his TurboIMAGE DBLOCK problem and I was really
quite "horrified" at how much work is involved in just setting up the items so
that the intrinsic will actually run without setting the create status field
to a non-zero value. Having to use the pseudo intrinsics ".LOC." to convert a
field into a "type-coerced" value is a pain in the you-know-what.

If you want to *RUN* a program inside a program I would prefer to do
something like:

 WORKING-STORAGE SECTION.
 01  WS-COMMAND-LINE.
     05  WS-CL-BUFFER            PIC X(79) VALUE SPACES.
     05  WS-CL-CR                PIC X(001) VALUE %15.

Down in the PROCEDURE DIVISION somewhere:

MOVE SPACES            TO WS-COMMAND-LINE
MOVE "RUN pgm-name" TO WS-CL-BUFFER
MOVE %15                TO CL-CR

CALL INTRINSIC "COMMAND" USING WS-COMMAND-LINE
                                                WS-ERROR-CODE
                                                WS-PARAM

Then I immediately check :

IF WS-ERROR-CODE <> ZEROES THEN
   <<do some error routine here>>
END-IF
IF WS-PARAM <> ZEROES THEN
   <<do some error routine here>>
END-IF

That's my -2 cents worth.......


Brian.

* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.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