Visit SDSUSA site please  

Go Back   mvsHelp Boards > Help Bulletin Board > Programming languages
User Name
Password
-->
FAQ Search Manuals Calendar New Posts Search Today's PostsMark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 02-19-2006, 02:54 PM
cjconrad cjconrad is offline
Senior Member
 
Join Date: Aug 2004
Location: Charlotte, NC
Posts: 38
Send a message via AIM to cjconrad
Default Cobol Determining its Operating System

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
Reply With Quote
  #2  
Old 02-19-2006, 04:45 PM
Bill O'Boyle's Avatar
Bill O'Boyle Bill O'Boyle is offline
Senior Member
 
Join Date: May 2001
Location: South Carolina, USA
Posts: 2,354
Thumbs up Cobol Determining its Operating System

Click below for Gilbert Saint-Flour's sub-program "SYS2COB" -

http://gsf-soft.com/Download/COB2SYS.shtml

Bill
Reply With Quote
  #3  
Old 02-20-2006, 09:08 AM
cjconrad cjconrad is offline
Senior Member
 
Join Date: Aug 2004
Location: Charlotte, NC
Posts: 38
Send a message via AIM to cjconrad
Default

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
Reply With Quote
  #4  
Old 02-20-2006, 01:23 PM
mushware mushware is offline
Senior Member
 
Join Date: May 1999
Location: Big Lake, Alaska/Olympia, WA USA
Posts: 2,176
Default

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.
Reply With Quote
  #5  
Old 02-23-2006, 01:10 PM
cjconrad cjconrad is offline
Senior Member
 
Join Date: Aug 2004
Location: Charlotte, NC
Posts: 38
Send a message via AIM to cjconrad
Default

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
Reply With Quote
  #6  
Old 03-17-2006, 08:51 AM
cjconrad cjconrad is offline
Senior Member
 
Join Date: Aug 2004
Location: Charlotte, NC
Posts: 38
Send a message via AIM to cjconrad
Default Follow-up

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
Reply With Quote
  #7  
Old 03-17-2006, 09:06 AM
Terry_Heinze Terry_Heinze is offline
Senior Member
 
Join Date: Sep 1999
Location: Minneapolis, MN, USA
Posts: 2,495
Default

Thanks for the follow up, Craig. I wish more posters would do that.
__________________
....Terry
Reply With Quote
  #8  
Old 04-08-2006, 12:25 PM
Steve Coalbran's Avatar
Steve Coalbran Steve Coalbran is offline
Senior Member
 
Join Date: May 2005
Location: Stockholm, Sweden
Posts: 847
Default

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:
SELECT OS WHEN UNIX THEN DO unixproc1 WHEN MVS THEN DO mvsproc1 WHEN VSE... ...
Assuming you cope with any platform it can run on then just pass it as a parm (or one of them), or have different entrypoints?
/Steve
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT -4. The time now is 05:06 PM.


Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.