Hi Gregor,
The magic word of the BASIC object code file indicates whether the program is a subroutine or a main program. Based on my testing, if the first executable line in the program is the SUBROUTINE statement, then the magic word is set to ace1. Otherwise the magic word is ace0. The MAKE.MAP.FILE command uses this information to mark the entries in the catalog space with an "M" or "S".
An example below with a main program and subroutine.
# cd BP.O
# od -xc TEST.MAIN | head -2
0000000
ace0 b300 0005 0000 0000 0000 0000 0000
254 340 263 \0 \0 005 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0
# od -xc TEST.SUB | head -2
0000000
ace1 b300 0005 0000 0000 0002 0000 0000
254 341 263 \0 \0 005 \0 \0 \0 \0 \0 002 \0 \0 \0 \0
#
Hope that clarifies.
Thanks,
Neil
------------------------------
Neil Morris
Universe Advanced Technical Support
Rocket Software
------------------------------
Original Message:
Sent: 01-29-2023 20:43
From: Gregor Scott
Subject: [UniVerse 11.3.4+] Object Code Search Path
Interesting to see that the &MAP& record differentiate between a mainline program ("M") and a Subroutine ("S") with zero arguments.
SORT &MAP& NAME WHO M/S ARGS 12:37:19 30-01-23 PAGE 1Catalog Name.................. Catalog Name.................. Who..... M/S Args!BPIOCP !BPIOCP uv-info S 0!CLEAR.PROMPTS !CLEAR.PROMPTS uv-info S 0*ADDAE *ADDAE uv M*AE *AE uv M*AE_ICOM1 *AE_ICOM1 uv S 0*AE_UPS *AE_UPS uv S 0*AE_VERSION *AE_VERSION uv S 0*CONVERT.UNITS *CONVERT.UNITS uv M*DC *DC uv M*DC4 *DC4 uv M*DEFINE.DF *DEFINE.DF uv M*GET.RESIZE.PARAMS *GET.RESIZE.PARAMS uv M*HS.CASE *HS.CASE uv M*HS.RUNINACC *HS.RUNINACC uv M*HS.SCRUB *HS.SCRUB uv M*HS.SCRUBINTER *HS.SCRUBINTER uv M*HS.SHOWCFG *HS.SHOWCFG uv S 0*HS.UPDFINFO *HS.UPDFINFO uv M*HS.WRTFINFO *HS.WRTFINFO uv M*LCINIT *LCINIT uv MPress any key to continue...
I am not aware of any indicator in compiled object code that make that an easy determination, so the MAP command must be doing some fancy object code interrogation to derive this difference.
------------------------------
Gregor Scott
Software Architect
Pentana Solutions Pty Ltd
Mount Waverley VIC AU
Original Message:
Sent: 01-19-2023 18:58
From: Gregor Scott
Subject: [UniVerse 11.3.4+] Object Code Search Path
Thanks @Mike Rajkowski
I did not know about the "M/S" field in the &MAP& file.
Interesting that it does show differently for Main programs and Subroutines with no parameters - so there must be something in the object code to identify the difference.
What it does not cover is identifying a function, or does it identify any local subroutines/functions within the global catalog object code.
------------------------------
Gregor Scott
Software Architect
Pentana Solutions Pty Ltd
Mount Waverley VIC AU
Original Message:
Sent: 01-19-2023 09:36
From: Mike Rajkowski
Subject: [UniVerse 11.3.4+] Object Code Search Path
Gregor,
While I have not used it, the MAKE.MAP.FILE command may help. ( Note that I believe it may only work on globally cataloged programs. )
The following is from the UniVerse User Reference Manual:
"MAKE.MAP.FILE
The information in the &MAP& file is the same as that displayed by the MAP command. By creating the
&MAP& file, you can take full advantage of the selection, sorting, and report formatting capabilities of
the RetrieVe commands to produce reports on the catalog space."
Also, note that while the MAP command does not show it in the listing, there is a dictionary item "M/S" that shows if the object code is a Main or Subroutine.
------------------------------
Mike Rajkowski
MultiValue Product Evangelist
Rocket Internal - All Brands
DENVER CO US
Original Message:
Sent: 01-17-2023 19:32
From: Gregor Scott
Subject: [UniVerse 11.3.4+] Object Code Search Path
I'm adding some validation to a routine that launches BASIC programs to ensure that the program's object code can be found (and is not a subroutine or function).
For main programs I think the search path is as simple as
- Local VOC
- GLOBAL.CATDIR (if the program starts with "*" - testing has shown that only globally cataloged programs that start with "*" can be run )
For subroutines and functions it gets more complicated
- Local object code of program that will call the sub/function
- Local VOC
- GLOBAL.CATDIR (for all the available prefixes: "*", "!", "-", "$"
Leaving aside the technical hurdle of pulling apart local object code looking for additional subroutine/functions, and the logic needed to detect if object code is a subroutine/function - that will have to wait for now.
Is there anything that I might have missed in these search paths?
Is there any case sensitivity settings/toggles that can influence the search in each of these paths?
Many thanks
------------------------------
Gregor Scott
Software Architect
Pentana Solutions Pty Ltd
Mount Waverley VIC AU
------------------------------