Mainframe Languages





There are many computer languages, and they have been evolving from machine language into a more natural way of writing. Languages are generally classified into machine language (direct machine code); assembly (using mnemonics to present the instructions to be translated later into machine language by an assembly program); procedural languages, also known as high-level languages (HLL) (Pascal, FORTRAN, Algol, JCL, COBOL, REXX, PL/I, Basic, and C are common), along with several other types. Mainframe programming is largely done in the procedural languages.

Share tech news, updates, or what's on your mind.

Sign up to Post

I'm trying to have a REXX script for a mainframe count lines such that it is determined how many times identical given lines occur. However, I'm getting invalid output; with the text simply getting copied and getting quotation marks at the starts of all of the lines. What is going wrong?
/*                               REXX                                */
/*                             ZOSSCHOL                              */
/*                                                                   */
/*  This REXX script reads in the input dataset, counts the number   */
/*  of repeated lines, and writes the output to another dataset      */
/*                                                                   */
      This line parses the input parameter,                            
      the first parameter goes into the variable mailid                
      any additional parms are thrown in the trash variable '.'        
say " "                                                       
say "z/OS Scholars Repeat Line Counter"         

Open in new window

In my RPGLE program, when I compile it
with option 14 and then F4,
I change the parameter value ->ALWNULL        *Yes
How can I do to write in the body of my program
this instruction to the compiler?
Using the unlink() and open() APIs from IBM, we are creating an IFS streamfile (IBM's open() api page:

If the streamfile needs to be replaced, the unlink() fails because the IFS object was not created with the authority to be deleted so we end up with either an error message or two conflicting entries in the streamfile (if we supress the error checking on unlink()). All object authorities must be controlled by authorisation lists, due to company security policy.

The authorisation properties of the open() api (and chmod() api) do not allow you to set the authorisation list of the new IFS streamfile, and the page linked above says that "Adopted authority is not used".

How do I set the Authorisation list when creating an IFS streamfile in RPG? Preferably to the same AUTL as the parent directory in the IFS.
I am running a script which calls the COBOL program on AIX but it throws an error saying "segmentation fault"..When I compile and link the COBOL program seperately it links fine but when I run it thorugh script it throws "segmentation fault eror"

1) Any idea on how to fix it?
2) As per my knowledge when there is a core creates a core file..But I could not see the core file as well.
Which is the best editor for programming languages?
Now, I have used HTML-Kit (build 292), and it's wonderful to work with, couldn't do without it.
I use it for HTML, XHTML, CSS and JavaScript. Can I use it for any programming language?

Or are there other tools I should use for programming languages? I will soon begin to study C, C++, C# and PHP. Now, I study HTML, XHTML, JavaScript, CSS and SQL. I want to find the best allround editor that I can use for any type of programming language, free or if I need I can buy it.

I have a Windows XP Pro SP3 32-bit, Windows Vista Business, and I will also install a Linux. I want to use this allround editor in Windows XP Pro.
I have searched the knowledge base and though I have found IM001 driver errors, nothing fits my situation.  I am using Micro Focus COBOL XA to connect to the ODBC driver.  The test of the connection from the System DSN tests out successful.  However, when the COBOL program tries to do the connection it gets an IM001 Driver error.  The driver is Microsoft SQL Server ODBC version 03.85.1117.

Any ideas how to figure this out?

Thanks, MaryOS  
First, I am new to socket programming. I found a great tutorial online and am reusing code from it. I am using a socket program to send hex commands to a production scoreboard. The hex commands increment/decrement counters, etc on the board.

In my socket program, I send the binary/hex commands to various 8 input ports for the board to process. In this example, I am using software to send the binary command to simulate input 1 (total count). The socket program randomly will return an error that it could not connect to the host.


I can run my program 70x within a minute or so and it increments the total counter 70x. Everything is fine. Then, out of nowhere, when called, the program tries to make a connection on port 4001 and it hangs. It then returns an error stating it could not make a connection to the host within the timeout period.

As for working/not working, it appears completely random. I can create the socket, send, and close the socket several times and all is fine. I may then wait 3 minutes and send, and the program hangs on the connect function. Any ideas?

thanks in advance - Adam
eval      sock = socket                       

if        connect(sock: p_connto: addrlen) < 0   
eval      err = errno                            
callp     close(sock)                            
callp     die('connect(): '+%str(strerror(err))) 

Open in new window

Can anyone explain with some examples how does the 88-level works.
I need to write a socket program in RPG that sends binary commands to a scoreboard on the production line. I have found tutorials on the web for writing socket programs using port 80 and doing some things like retrieivng webpages, but they are not quite what I need.

My question is, how do I send binary commands to a server using the SEND function from the built in APIs on the as400?

For example, I know that the scoreboard I am using as the server is listing on port 4001. Also, the binary command 02 00 01 01 (command + Data in hex according to the scoreboard company) is a command that the scoreboard will recognize.

below is a small chunk of code that I am using to try and send (prototype, etc not incuded). It seems to connect fine, but I can tell the command is not being executed. I am new to socket programming also, so I am trying to learn as I go.

// The below command simulates input (Total Count) on port
D command         s            32A   inz('02 00 02 01')     

eval      cmdLen = %len(%trim(command))         
callp     Translate(cmdLen:command:'QTCPASC')   
eval      rc = Send(sock: %addr(command): 32: 0)
if        rc < 32                               
eval      err = errno                           
callp     close(sock)                           
callp     die(%str(strerror(err)))              

Open in new window

Hi Friends,

I try to combine 2 working parts of programs that work fine, now I get doubl;e definition errors...
Maybe because it's some time ago that I wrote this kind of stuff, but I can't Find the solution
(In real live the PM#S are not 4 but 400)

And yes I see there is a double definition, but how to solve this?

Thanks EXPERTS !!!!!

P #BLDSTR         B                   EXPORT                     
D #BLDSTR         PI          1600A   VARYING                    
D   StrInp                    1600A   CONST VARYING              
D                                     OPTIONS(*VARSIZE)          
D   PM#001                     100A   CONST VARYING              
D                                      OPTIONS(*VARSIZE:*NOPASS)  
D   PM#002                     100A   CONST VARYING              
D                                      OPTIONS(*VARSIZE:*NOPASS)  
D   PM#003                     100A   CONST VARYING              
D                                      OPTIONS(*VARSIZE:*NOPASS)  
D   PM#004                     100A   CONST VARYING              
D                                      OPTIONS(*VARSIZE:*NOPASS)  
DPM#DS            DS                                        
D PM#001                       100A   Overlay(PM#DS:*NEXT) 
D PM#002                       100A   Overlay(PM#DS:*NEXT) 
D PM#003                       100A   Overlay(PM#DS:*NEXT) 
D PM#004                       100A   Overlay(PM#DS:*NEXT) 
D PM#               

Open in new window

I always though that it was necessary to do an open cursor, select without into, fetch and close cursor for embedded DB2 SQL in COBOL.

However, I just coded, compile and tested a SELECT INTO in COBOL and from the testing it appears to be working.  Am I just being fooled, I want to make sure that it is okay to do this and it is correct.

Thanks, MarOS
I have existing program of RPGLE type in which now SQL is embbeded.
Is there any option in ALDON to do so?

How to change existing Source type RPGLE to SQLRPGLE in ALDON?
I know it is possible in Tunrover but not sure about ALDON, I am new to ALDON

Thanks in advance
I'm trying to call a very simple C ILE service program from RPG.

The C function looks like this:
int Add(const int a, const int b) {
 return a + b;

Open in new window

I'm able to call it using the RPG code below...

     h dftactgrp(*no) BndDir('MYLIB/MYBNDDIR')

     d HelloWorldPR    pr              *   ExtProc('HelloWorld')
     d AddPR           pr             5  0 ExtProc('Add')
     d   num1                         5i 0 const
     d   num2                         5i 0 const
     d ReturnNumberPR  pr             5i 0 ExtProc('ReturnNumber')

     d result          s              5i 0 Inz(*zero)
     d n1              s              5i 0 Inz(*zero)
     d n2              s              5i 0 Inz(*zero)
       n1 = 3;
       n2 = 4;
       result = AddPR(n1:n2);

       *inlr = *on;

Open in new window

However, when I step through the C function in debug, instead of 3 and 4, a and b equal 319266122 and 1593839616. So when they get added together they result in a decimal-data error. What do I have to do to get the parms in a format that jives w/ the C function?
we have to transfer data from an old rpg program to a new SQL based database, does anyone know if there are utilities or a procedure to do this? The rpg program is compiled an run under dos environment. thanks.
Please look at the following code, when the record identifying indicators will be on for the secondary file will be on.


ICNSARTF       01                                        
ICNSLSTF       02                                        
ICNSORDF       03                                        
I              FILL02                      ORD_FILL02    
I              FILL01                      ORD_FILL01    
ICNSAREF       06                                        
ICNSCNFF       04                                        
I              $08ART                      W08ART        
ICNSPRCF       05                                        

Primary file indicator is '*in01' is on, but other indicators (*in02, *in03, *in04, *in05 & *in06) are not on.
Thank you for your time.  We have many stored procedures residing on an AS400, that run RPG programs.  We call these stored procedures from C# and have been using them for years.  We recently got a new web server that we are planning to migrate to, and I cannot get the stored procedures to run without access errors.  The RPG program does not have the necessary libraries available to complete its transaction.  The library list from my ODBC connection does not seem to take effect any more.  The RPG guys do not want to set the library list inside the code, so that we will be able to hit testing libraries in the future when there are changes (they would like for me to continue to control the library list from the ODBC connection).  The new server is Windows 2008.

My code just hangs and the 400 gets an error in message queue QSYSOPR.
I get error CEE9901 and the 400 shows error CPF2105 (basically a file is not found in the library list).

Thank you
what would be value of tax-2?

01 price   s99v99 value 20.85.
01 cost    v99    value .07.
01 tax      v99    value 0.0.
01 tax-2   value 0.0.

multiply price by cost giving rounded tax.
move tax to tax-2.

what would be the result of counter-1, counter-2 and counter-3 after loop executes.

01 counter
     02 counter-1 pic 99 value 02.
     02 counter-2 pic 99 value 00.
     02 counter-3 pic 99 value 00.
     02 counter-4 pic 99 value 00.

perform until counter-1 > 10
   add 2 to counter-1
   add 3 to counter-2
   add 1 to counter-3
someone knows the difference between CF01 and CA01
I'm talking about using STRSDA and indicator use.
I have a small program I am working on to help with a data conversion that needs to be done soon(tm). The program compiled fine on Thursday (albeit with a bug), but in fixing the bug and re-compiling this morning the SQL precompiler rejects the compile citing the following error:
"SQL0312  ...  Position 52 Variable FLTDATA not defined or not usable."

Which is complaining about line 255:
(note that flexConv3 is a cursor declared from a host variable via a PREPARE statement.)

I am certain that the FLTDATA variable/field is defined clearly at the top of the program, and there are no scope problems such as different procedures/subroutines/source members involved:
"D FLTDATA         S          32767A   VARYING"

I tried to re-compile the program from Thursday's source and I get the same problem. The only change since thursday was an i o/s (os400/iSeries/etc.) upgrade to v6r1. Does anyone know what changes were introduced that cause the above FETCH statement to fail to recognise the variable declaration?

I am looking for a humorous reference to computer programming languates.

Here is a link to elaborate what I am looking for:

However it is not this one.

It compares computer languagues to roads and wheels.
From my memory which might be rusty it said something like.
If cars were like COBOL then we would need thousand wheel trasporation
machine to drive them.

If cars were like Smalltalk then programms would build the wheel and
ask the wheel to contrsuct itself.

So 500 points to somebody who can find a web reference some where.

Please people don't take offence btw - if people are passionate about
there favoured language.

I have query regarding SQL statement which i need to use where from file is flat file and i need to extract records from that Flat file based on values in position 15th = 'X'
As below
Select * from Flatfile where Flatfile (position 15th = 'X') Is it possible?


Is it possible from below Code?
CPYF       FROMFILE(&flib/Flat file)
           TOFILE(&flib/File2) MBROPT(*ADD)
           INCREL((*IF Flatfilefield *EQ 'C'))  

Please guide .
Are there any COBOL certifications which is highly recognised ?

I would like to activate a discussion about the subject " Future of COBOL and Mainframes".
What do you think? Will these environment live on? The death of COBOL and Mainframes were promised many times? By trend I think there is no chance for Mainframes and COBOL (for a very long future ) but how long will this dinosaur live on?


I am working on a project to convert a system 36 application to native AS400. For the first phase we are converting System 36 files to DDS, OCL procedures to CL and RPG36 to RPT.
The converted display files contain the USRDSPMGT keyword to handle the system 36 style lists (which at a later date will be replaced by subfiles). The lists display correctly but are built very slowly, one line at a time, with the each screen taking 4 or 5 seconds to complete. If any valid command key (roll up, roll down, enter etc.) is pressed while the list is being built the remainder of the list displays almost immediately (i.e. a single press of a function key lists slowly while a double press lists quickly).
How can I force the whole list to appear quickly ona single key press?
Below are what appear to be the relevant lines from the program and DDS.
[code]FSRCOSLFMCP  F    1280            WORKSTN                    
F                                              KSLN   LINE  
F                                              KID    WSID  
F                                              KINFDS INFDS  
F                                              KINFSR INFSR  
ISRCOSLFMNS  99   1 C                                
I                                        1   1 WKSCID
I        NS  01   1 C1                              
I* FORMAT-F1                                        
I                                        1   1 WKSCID
I                                        2  11 [/code]…

Mainframe Languages





There are many computer languages, and they have been evolving from machine language into a more natural way of writing. Languages are generally classified into machine language (direct machine code); assembly (using mnemonics to present the instructions to be translated later into machine language by an assembly program); procedural languages, also known as high-level languages (HLL) (Pascal, FORTRAN, Algol, JCL, COBOL, REXX, PL/I, Basic, and C are common), along with several other types. Mainframe programming is largely done in the procedural languages.

Top Experts In
Mainframe Languages