9

I have to find some logic from an old legacy code. My manager says is COBOL, I'm not sure about it. I have tried to find some keywords on cobol tutorials without any luck.

Here are some code snippets:

PROC(&QPROG);
VERIFY OFF PROC;DECLARE &MSG1 AS A75;
/* DON'T CALL SCREEN IF IT'S FROM  */
IF &QPROG NE 'YUITG' THEN DO;
   CALL QAAF;
   SCREEN QUERY LOADED QAAF OTW DO;
      PRINT 'SCREEN WILL NOT LOAD';
      EXIT;
  END;
END;
ON ERROR DO;PRINT &&RC;EXIT; END;

IF LENGTHB(&P_WHAT) = 4 THEN DO; &P_WHATT = SUBSTR(&P_WHAT,1,1) CAT
   ', ' CAT SUBSTR(&P_WHAT,2,1) CAT ', ' CAT SUBSTR(&P_WHAT,3,1) CAT
   ' & ' CAT SUBSTR(&P_WHAT,4,1);
END;
DECLARE &KEYWORDD_A(0) AS A1;
DECLARE &KEYWORDD_F(0) AS 99L;
&KEYWORDD_A=
(SUBSTR(&KEYWORDD,1,1),SUBSTR(&KEYWORDD,2,1),SUBSTR(&KEYWORDD,3,1),
SUBSTR(&KEYWORDD,4,1),SUBSTR(&KEYWORDD,5,1),SUBSTR(&KEYWORDD,6,1),
SUBSTR(&KEYWORDD,37,1),SUBSTR(&KEYWORDD,38,1),SUBSTR(&KEYWORDD,39,1),
SUBSTR(&KEYWORDD,40,1));
&KEYWORDD_F = FINDEX(&KEYWORDD_A = ' ',ALL);

IF &PROG EQ &NAV THEN DO;
   &ALLPROG = 'YES';
   &PROG = 'PR2';
END;
-TOP_PROG
CMS FILEDEF QAA2 DISK QAA2 NOMAD A6 (LRECL 100;
WRITE '/* REPORT */' ON QAA2;
WRITE '&GRP        = ''' CATB &GRP CATB ''';' ON QAA2;
WRITE '&MGTRPT     = ''' CATB &QPROG CATB ''';' ON QAA2;
IF &AMPRFROM NE &NAV THEN DO;
   WRITE '&AMPRFROM = ''' CATB DISPLAY(&AMPRFROM) CATB ''';' ON QAA2;
END;

CLOSE QAA2;
Cœur
  • 37,241
  • 25
  • 195
  • 267
Neir0
  • 12,849
  • 28
  • 83
  • 139
  • PLSQL Probably, not quiet sure? – Reno Jones Feb 21 '13 at 17:58
  • 1
    Possibly SAS? Here is a link to a PDF. [LINK](http://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=2&ved=0CD0QFjAB&url=http%3A%2F%2Fwww2.sas.com%2Fproceedings%2Fsugi23%2FPosters%2Fp199.pdf&ei=nGAmUbOmAYu02AWZkYHIDw&usg=AFQjCNE1h9c5t43P3Ww01muqbBShLz52Ug&sig2=4KRtdzMCH2SNdOghT32ong&bvm=bv.42661473,d.b2I&cad=rja) – Benjamin Trent Feb 21 '13 at 18:02
  • @bwtrent is SAS a programming language? Glanced at the link and I understood it is kind of a tool, or not? – Neir0 Feb 21 '13 at 18:16
  • yes it is a language. [WIKI LINK](http://en.wikipedia.org/wiki/SAS_language) – Benjamin Trent Feb 21 '13 at 18:17
  • Another problem line is "SCREEN QUERY LOADED QAAF OTW DO;" – Bruce Martin Feb 21 '13 at 22:23
  • An extra pointer to EXEC2 is that &KEYWORDD is too long for EXEC. We may have nailed this particular language for you, but I now notice it is part of a NOMAD system, and it is clear that there is much more code involved than this. – Bill Woodger Feb 22 '13 at 00:58
  • OK, definitive is if the very first line of a file starts with &TRACE. And if your'e running VM, I suppose :-) – Bill Woodger Feb 22 '13 at 16:26
  • If "script file" does not start with "*" (EXEC) or &TRACE (EXEC 2) or "/*" (Rexx) then I think it is pure NOMAD, with the ability in the language itself to "shell out" for operating system services (like the FILEDEF) or that NOMAD operates in a similar manner to EXEC/EXEC 2/Rexx with commands that are not part of the language, as described in exchange with NealB below. – Bill Woodger Feb 22 '13 at 20:20

4 Answers4

24

EDIT:

This has been bugging me. Reasoning that it was not EXEC and not Rexx, but was clearly running in CMS, that left EXEC 2.

However, I now believe it is NOMAD itself. Difficult to confirm, but here, http://www.tallant.com/portfolio/webpages/web/nomad/nomad2.html, are examples of some of the code.

Whether it runs from/alongside EXEC 2, I don't know. It may just operate in a similar manner, or just have support for "shelling out" to CMS or CP as necessary to perform "system functions".

So, it is probably not...

It is EXEC2.

There are two "old" command languages with VM/CMS, the oldest, and most limited, is EXEC. Rexx was the "new" command language.

If you think that this is bad, imagine what EXEC is like. EXEC and EXEC2 have similarities to CLIST, but I don't know if they have a joint ancestor.

So, it is what is these days "a shell-scripting language" to do with IBM's VM operating system, which is the original "Virtual Machine" and which includes the ability to run multiple copies of a "single-user operating system" called CMS (Conversational Monitor System, I believe) which only runs on VM and which is where the "CMS FILEDEF" comes in (it is "shelling out" to CMS), as well VM can run, as single or multiple instances, full-blown IBM operating systems such as DOS/VSE, MVS, VM (again, which can then run other "Guest" operating systems) and these days z/OS, z/VSE and, I don't know, but probably Linux.

Edit. It is very bad practice that it includes the "/" "/" comment. If the first line of a file starts and ends like that, then the contents are assumed the be Rexx. VM supports all three "languages" but runs different interpreters depending on how the program starts.

From memory, EXEC starts with an * (comment), EXEC2 does not need that, and Rexx with the /* to */, which on CMS can span more than one line.

Bill Woodger
  • 12,968
  • 4
  • 38
  • 47
  • 1
    Despite two edits already, I forgot to mention that VM is an IBM Mainframe operating system. – Bill Woodger Feb 22 '13 at 01:05
  • Might be a good idea to point out that this is probably a NOMAD procedure with imbeded EXEC2. Several of the statements in the script must be NOMAD because they are not EXEC2. Kind of like what happens when an HTML document contains imbedded javascript, the result is neither pure HTML or javascript. Good sluthing... – NealB Feb 22 '13 at 15:54
  • I've been searching more. An EXEC 2 starts &TRACE. From memory (amazed nothing but scanned documents available) a command in an EXEC 2 which was not "recognised" as EXEC 2 would go to the "environment" it was run from, if still not resolved to CMS, if still not resolved to CP, or something like that, so easy to get that type of mix. – Bill Woodger Feb 22 '13 at 16:25
  • Exactly... This approach to scripting has been around for a very long time. CLIST and REXX do it as well. In fact, I believe this is a very common "trick" employed among many scripting languages - if something is not recognized, perform variable substution and push the resulting string to the invoking environments command processor to do something with. Each processor does the same thing until one of them handles it and returns; or "kaboom" when it runs out of stacked processors. – NealB Feb 22 '13 at 16:51
  • Updated with new thoughts. There were those "upvotes" again for something which was "not quite right", perhaps :-) – Bill Woodger Feb 22 '13 at 20:21
3

This is CLIST. Commonly found on IBM Mainframes.

EDIT

On second take, this isn't CLIST. It looks like a close cousin of CLIST though (of which older IBM systems had a few variants). My best guess is that this a rather old EXEC of some sort running under CMS.

The line:

CMS FILEDEF QAA2 DISK QAA2 NOMAD A6 (LRECL 100;

looks like an escape to CMS for file allocation so that makes me think of CMS.

Someone suggested that it could be SAS. SAS on IBM systems can have a CLISTish look to them too but I don't think it is SAS (only worked with SAS a few times a very long time ago so I stand to be corrected on this too).

I'm not so sure this is EXEC2 either. I dug up the VM SP EXEC 2 Reference Manual. Some of the things in the example don't seem to "translate" into EXEC2: PROC, DECLARE, LENGTHB, CALL and CAT for example are not described in the manual. I used CMS back in the 80's for a while and actually had to write stuff similar to this, but that was a long time ago and I really don't remember much of the syntax.

About all I can say is that this stuff looks like a derivitave of the scripting languages found on IBM systems of the mid to late 1980's.

It certainly is not COBOL or REXX.

NealB
  • 16,670
  • 2
  • 39
  • 60
-1

I'm not sure about this but it looks like it may be REXX. Take a look:

http://en.wikipedia.org/wiki/Rexx

Jurgen Camilleri
  • 3,559
  • 20
  • 45
  • Thanks. I looked quickly at it. And I have notice that the use of variables is quit different. In my snipets, the variables are used preceding with & Ex: &ALLPROG = 'YES'; – Neir0 Feb 21 '13 at 18:08
  • Its nothing like Rexx, Its Clist or some variation of it – Bruce Martin Feb 21 '13 at 22:17
-1

This is a CLIST code.

Earlier, there use to be lot of CLIST code and now REXX has taken its own place. But still CLIST is being used in many Mainframe systems.

Purus
  • 5,701
  • 9
  • 50
  • 89
  • 1
    No, it is not. CLIST is not available in an environment where CMS is also availabole. If you really feel it is CLIST (under MVS/z/OS) please explain how it is so easily accessing CMS, which is a separate operating system, which although it might be running "alongside" another operating system, both of those operating systems thing that they have the entire world to themselves. – Bill Woodger Feb 22 '13 at 18:20