![]() |
|
#1
|
|||
|
|||
|
I had hoped that there would be an existing post on this topic, but I can't seem to find many threads on mvshelp -- I haven't been on it in several months, but I recalled there being many.
In any case, is there a portable way within Cobol to see what the Operating System is (e.g. Unix, OS, etc)? By portable, I mean that it would be supported in many/most compilers, such as IBM and MicroFocus? Thanks, Craig
__________________
Craig Conrad, PMP |
|
#2
|
||||
|
||||
|
Click below for Gilbert Saint-Flour's sub-program "SYS2COB" -
http://gsf-soft.com/Download/COB2SYS.shtml Bill |
|
#3
|
|||
|
|||
|
Bill,
thanks for your quick response. My program actually uses code similar to this to pull information from the MVS Control Blocks. Ironically, this is the very code that led to my inquiry -- when this code is compiled and used on Unix it will abend, as those control blocks/chains don't exist in that environment. I am looking for a way (intrinsic function, some trick, etc) in Cobol to know if it is in Unix or MVS, and to skip MVS-specific code in the former case. Thanks, Craig
__________________
Craig Conrad, PMP |
|
#4
|
|||
|
|||
|
So far as I know, standard COBOL does not include anything which would identify the machine / opsys on which it is running. Two possibilities leap to mind: (1) call a subprogram which will invoke an opsys-dependent feature and return a suitable RC - one sub each for MVS and *NIX; (2) test for the hex value of some character, e.g. lower case "a", which will be different for ASCII and EBCDIC. Other than that, I'm fresh out of ideas.
|
|
#5
|
|||
|
|||
|
While it isn't perfect, I like your suggestion of checking the hex value of a given character ... I'll give it a try.
Thanks!
__________________
Craig Conrad, PMP |
|
#6
|
|||
|
|||
|
I wanted to let anyone interested know that I solved this by the recommendation given above -- generally, it is:
01 OpSys-Compares. 05 Lower-a PIC X(01) Value is 'a'. 05 Upper-A PIC X(01) Value is 'A'. If (Lower-a < Upper-A) Move 'Unix' to WS-OpSys Else Move 'MVS' to WS-OpSys End-If. Of course, this is really a check for ASCII vs. EBCDIC, but that is enough for me to assume Unix vs. MVS. Thanks for your help. Craig
__________________
Craig Conrad, PMP |
|
#7
|
|||
|
|||
|
Thanks for the follow up, Craig. I wish more posters would do that.
__________________
....Terry |
|
#8
|
||||
|
||||
|
Hi Craig,
This lower to upper comparisson sounds a tad dodgy to me? If it's just which OS it's running on, can that not be simpler supplied as an installation parameter? does it have the sort of internal logic.... Code:
/Steve ![]() |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|