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 am still trying to learn this version of SQL (DB2 on a iSeries), and the query that I have created to give the average time by location is using so much of the system that it times out about half the time. I wanted to see if there is a better way to do this.

The purpose of the query is to return a grouped list of average time by the location with the top outlier or top average time removed.
Here is a data example for one location:
Location            AverageTime
South Inp      162
South Inp      151
South Inp      0
South Inp      310
South Inp      130
South Inp      149
South Inp      225
South Inp      288
South Inp      44
South Inp      32

310 being the max value should be removed from the list before the average is done.


	AVG(ResponseTime) AS ResponseTimeOLR
From (
			when AsmtLoc IS NULL Then 'Empty'
			Else AsmtLoc
		End AS AsmtLoc,
		TIMESTAMPDIFF(4,Char(TIMESTAMP(Date(To_Date(AsmtDate, 'MM/DD/YYYY')),Time(Left(AsmtTime,2)||'.'||Right(AsmtTime,2)||'.00')) - TIMESTAMP(Date(To_Date(CallDate, 'MM/DD/YYYY')),Time(Left(CallTime,2)||'.'||Right(CallTime,2)||'.00')))) AS ResponseTime
	From (
			MAX(Case When ASCQUN = 4046 Then ASCASN End) AS AsmtLoc,
			MAX(Case When ASCQUN = 4045 Then ASCASN End) AS IsMeth,
			MAX(Case When ASCQUN = 3730 Then ASCASN End) AS CallDispo,
			MAX(Case When ASCQUN = 3726 Then ASCASN End) AS CallDate,
			MAX(Case When ASCQUN = 3755 Then ASCASN End) AS CallTime,
			MAX(Case When ASCQUN = 3761

Open in new window

We are trying to convert a bunch of iSeries reports to PDF.  Right now I'm working with a trial of Adobe Acrobat XI Pro.  When I open a text file in Acrobat I lose all of it's formatting.  None of the columns line up.  It's like it's missing the line feed or something.  Is there a setting I can change to make Adobe keep the same format my report has?
I have a number of commands to run on linux of which the following are examples:
bsub < myjob1.lsf
bsub < myjob2.lsf
bsub < myjob3.lsf
bsub < myjob4.lsf
There could be 20 or more of these. I do not want to manually type each one into the command line, but would like to have a shell script to do it.
My attempts to do this have resulted in either just writing the above out to stdout, but they are not 'entered', or the following error:  line 3: myjob.lsf: No such file or directory.
Is there a way to have a script add a line then have me hit 'Enter' and then go to the next line ?
This is a unique request...I have a file that I FTP to a main frame and normally if the the record length of each record in the text file is say for example 85 I would just put:

quote site lrecl = 85

This usually works and my data is NOT Trunacated...however I have a very unique file that one of our clients gets that does NOT have any CRLF in the is one continuous string of data making it impossible to put an lrecl = ??

How can I get around this?

I would like to insert into the same file being read when values don't match ??

Please See Attached Document.

Thank You.

Working on iSeries V5R4.

Running Java for the first time on the iSeries where we are using a CL to call a Java component that will process files sitting in a directory on the IFS. The file name and file location will be sent to the Java component which will transform the file from a flat file to an XML and put the output into a different directory. Depending on the return code from the Java component the CL will move the input file from an input directory to either an error or a successful output directory.

If the Java component fails (eg invalid character on a record etc) we want to return an error code and we want the CL to act accordingly. ie move that file to error directory and read in the next file until all files in the directory are processed.

We have successfully called a Java component using both QSH and via the RUNJVA comand however processing the return codes is still a mystery.

The CL calls QSH which calls the Java component. But how do you bubble the error codes back from Java to QSH and on to the CL?

We are hoping not to use MQ or data queues to pass messages back - we are hoping there is a simple way to just pass back a code?


In my application currently we are printing the reports in RPGLE using program described printer files concepts. once the reports are generated then we are copying spool file into physical file using CPYSPLF command with control as *FCFC.

now currently I am planning to build the reports into physical file member instead of generate spool file and copy the spool file. my intention is without changing the program logic i.e) instead of write the data into spool file , reroute printer data into physical file.

currently i didn't know how to route the printer data into physical file. the data in physical file should be as cpysplf command *FCFC way.

could you please help on me.
Sorry to post without doing my own research first.  Time crunch.  Demo coming up and I am running way behind.  So thank you for your patience and assistance.

I have a popup window which is accessed from multiple systems.  In some systems it is from a 80 column screen and others via 132.  When the screen size doesn't match the popup it blanks the back ground.  How can I keep the back ground displayed (I have assume) or change the pop size depending on the calling program (If this will fix the problem.)  

Also, even when the popup is called via a program with the same size screen; it will blank the background then second time the popup is displayed if another screen has not been displayed first.  So, back to back popups cause the second one to blank the background screen as well. Can I stop this?

Thank You! Thank You!!
I'm trying to print from different drawers of a Kyocera Taskalfa 300ci depending on the transaction type I'm printing (Invoices from drawer 2, credits from drawer 3 etc.)
using the source drawer parameter makes no difference, it prints from the same drawer regardless if what I enter.
Has anyone had any experience of doing this, any help would be greatly appreciated.
Using a subfile where users can add and delete data on the subfile screen.  When they delete a record everything works fine.  When I try to add a record, after the subfile is initialized with SFLCLR the subfile load blows up with "an attempt to write a duplicate record" error. In some other posts I saw the SFLCLR clears the subfile but not the display, but cannot stop the error from happeneing. I can put my code out there if necessary.  I am a fairly experienced programmer in RPG but have never encountered this problem before,  I have wrote subfiles before. Hope you an help.
Hi everyone,

    Recently our director retired, and he was the only one that really knew anything about our VMS system, we are slowly migrating everything off of it, but I have an issue right now.  

We have a program that he had written in basic that FTPs a couple files over and makes necessary changes to them.  The problem is that the program used an old IP address in there for the server it is getting the files from.  I can edit the source code to the .bas file, but I cannot figure out how to compile it.  I tried $BASIC FILENAME
but I get an error for the line "%INCLUDE "MVPMAP:MVP_EXTRACT_MAP.BAS"

-BASIC-F-DEV, error in device name or inappropriate device type for operation
at line number 21 in file ALLEN0$DKD100:[MVP_REAL.BAS]MVP_EXTRACT_NEWIP.BAS;1
I have an sqlrpgle program.
It makes several sql statment.
Sometime, one of this statment goes in error
and the program aborts.
Is there a way with commit settings
in order to confirm all the operation only
at the end of the program and only if there was no error?
Is there a way to do the same of the following macro code? thanks




This is only an example code to explain better my necessity.

I need it in order to do not rewrite my sql code every time I change fields in table1.
Or if I have to use my code for different table.

my website & db are design using the encoding charset=windows-1256
i want to send data to other website, but that data need to be UTF-8

i want to convert it from charset=windows-1256 to be utf-8 inside the php code and not the db

please advice
We have a large number of job logs saved to QSEZJOBLOG.   I would like to search for a certain job and/or a certain job for certain users.  Is there a way to dump this to a file so I can use SQL?    Thanks!!
I wonder if somebody could help me?

I am creating an output file on the AS400 using RPG III to create a flat file according to a bank format specification.   The physical file on the AS400 is 100 characters in length.

The bank specification requires  the  header records and the trailer record to be 80 characters in length while the data records in between are 100 characters in length.

When i use client access to download the file to the pc as a .txt file and send to the bank the file is failing because it doesnt seem to have carriage return/line return characters which will then translate down to the  text file.

Do i have to output a hexadecimal character in position 80 and position 100 in the rpg file in order for this to output correctly in wordpad?  If so, how do i do this in RPG III?

Or is there another workaround?
For example
Could somebody give me some VBA code which i could use on the downloaded file which would insert a carriage return/line feed  in position 80 and 100 with a series of IF statements..
. .. eg IF character in position 1 is number then output a carriage return, line feed in position 100
          IF characters in position 1 to 3 equal VOL then output a carriage return,line feed in position 80.

I attach 2 files.
1 is the original as400 file and the second is the sample of how the file is behaving in notepad and how the bank expect it to be.

We are looking for a way to print a report from Unix to a Xerox 7346 printer that doesn't go through the windows print options.  Have any of you done this and if so how?

The requirement driving this is that we need to use the secure print option of the Xerox but since the report isn't routed through the windows interface, the secure print option isn't available.

The source reports are in cobol.

Thank you,
Steph M
Apparently, though I am using the paperclip (attach apparatus) it is not actually attaching so I will take your advice, Tom, and paste that along with the original question below.

We have a as an example a file with 10 records.  The first display of this file is at the top of the Below Document which is at this time considered an unsorted file.  On this below display the second group is that same file sorted using the control card SORT FIELDS=(9,12,CH,D), in essence sorting the key field in descending order.  The third group takes the same unsorted file at the top and using the control card SORT FIELDS=(9,12,CH,A) gives you an Ascending sort.  The fourth groups is what I actually need..  I have been told there is a way to get there using an Alternate Sort Sequence in the JCL.  Please assist.  Below are the examples

11978528TPA00020901920111224000004771EJJONES INC                  
10059794TPA00024142520120123000056256HASSELBROCK, WATSON & CASE    
10150152TPB00002540092012013000000257LACEY T & D                  
10150162TPA00025401020120130000000257LACEY T & D                  
10054652TPA00025901220120126000000322FOLLIN TELEPHONES            
50013918TP000021861420111216000000609WATSON TIRE SALES            
50013916TP000021861520111216000001218WATSON TIRE SALES            
51028062TPB00022042220120110000021780ACE PLASTICS                  
50059764TP000024142520120123000056256HASSELBROCK, WATSON & CASE    …
Hi all,

I have a table with 460+ million plus rows. This table is read "once" a day to retrieve a single maxrownum used for downstream processing. The problem I am having is that this select SQL is taking about 1 hr 10-20 minutes to retrieve this one value! How can that be? I have only three indexes one of which is keyed off of the maxrownum.

Can anyone suggest/recommend a performance tip/strategy that I can use to improve my retrieval process? This may not be the best plan, but I was thinking perhaps I could create a tiny whinny table to store the maxrownum value and read from the small table for theis value. But, then I have to introduce another table, additional I/O, extra storage and maintenance, etc, etc in to the equation...So, what does anyone think about that?

Please do send in your comments, suggestion and recommendations. Articles and other pointers are very much welcomed.
It has been over 25 years since I last programmed on a IBM Mainframe....

I seem to remember PL/S was a one of the languages that VM/CMS was written in...

Does system level program only happen in assembler or are there higher level languages ?

I have searched high and low for this.  When coding a "Call 'ABEND" using ABEND-CODE,ABEND-OPTION to force an ABEND, customarily you will move a code (4 digt) to the ABEND-CODE.  The issue I am encountering is there are a range of numbers that are allowable to be moved to ABEND-CODE.  If the number is too large it will give one a problem.  Does anyone know what range of numbers (ie 0001 - 2999) that are allowed?

Open in new window

Hello Guys,

I'm working on IBM Mainframe, TSO environment. I've got JCL code to apply a function on a DB2 database. The JCL code is as follows:
****** ***************************** Top of Data ******************************
==MSG> -Warning- The UNDO command is not available until you change            
==MSG>           your edit profile using the command RECOVERY ON.              
000001 //BILLING  JOB MSGCLASS=H,NOTIFY=&SYSUID                                
000002 //******************************************************************    
000003 //*                                                                     
000004 //*                                         
000005 //*                                                                  
000006 //* This job is used to run the BILLING program to produce the          
000007 //* customer account billing report                                     
000008 //*                                                                     
000009 //*                               
000010 //*                                                                     
000011 //******************************************************************    
000012 //BILLING  EXEC PGM=IKJEFT01,                                           
000013 //         PARM='DSN SYSTEM(DB1S)'                                      
000014 //STEPLIB  DD DISP=SHR,DSN=DB2.V9R1.SDSNLOAD                            
000015 //         DD 

Open in new window

I am using a WSCST to get *SCS prints with Chinese charcters to print. However, prints wider than 80 chars are printing in portrait and data overprinting. How do I get it to print in landscape?
In the WSCST source I have tried making the orientation for PORTRAIT the same as LANDSCAPE to try and get something out in LANDSCAPE but to no avail.

  DATA ='1B266C334F'X.
  DATA ='1B266C334F'X.

We have recently loaded appropriate fonts from IBM (Simplified Chinese) and prior to this project the prints with 198 characters automatically rotated. I have not changed the PAGRTT parm on the PRTF it is still *AUTO

Any assistance greatly appreciated.
I have a string STR='5+5'
so in rpgle,
I try this:
How to catch the error in order to resume it
and to alert the user that STR contains wrong data?

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

No Top Experts for this time period. Answer questions to earn the title!