Posts

AS400 RPGLE: CLEAR - To clear variable, Record Format and Array

 CLEAR is used to clear a variable by setting the value to its default value based on the variable type. Character filed to blanks Numeric field to 0 CLEAR will set the indicator to 0 (OFF) CLEAR will clear the whole record format to default values CLEAR can clear entire array or just the instance of an array if the instance/Index is specified

AS400 Display: Window title

Below keyword will let you display the Title of the window WDWTITLE((*TEXT &WTITLE) (*COLOR WHT) *LEFT) Will display variable WTITLE as Window tile on the left.

SQL: Query to get the server Name in AS400

Current Server will give the server name of the as400 in which the query runs select current server from sysibm/sysdummy1 

SQL: To Identify a non-Numeric value in a Alpha Character Field

Below query will return the records that are having non numeric value in Field1 coumn. select * from Tbl1 where   translate(Trim(FIELD1), '         X',   '1234567890 ') <> ' '            translate(Trim(FIELD1), '         X',   ' 1234567890 ') Trim will remove trailing and leading spaces. Translate will translate FIELD1 values of 1, 2, 3, 4, ....0 to ' ' as mentioned (10 blanks one for each number, translation happens character by character) and the ' ' will be translated to X. Hence if a record has FIELD1 has numeric value all the numbers will be converted to blanks and ' ' inbetween will be converted to X. hence if there is a record that is non-blank which means it has non-numeric value which the translate couldn't convert Translate in update: Field1 = 1O5719374 update TBL1  set FIELD1 = translate(FIELD1, ' ','O')  where                                    FIELD2 = 15145         

DB2 table Created with Name more than 10 character in as400

We can create a table in AS400 using the DB2 create command which will be saved as PF file in AS400 with the same name if the name is <= 10 character because as400 object name is limited to 10 character So when we create a table with name more than 10 character, system will allow you to create the table and even let you access the table using STRSQL or any other external application which use DB2 query. But the PF will not be saved in same name as it is more than 10 character. instead it will be saved as something like 'TBL_D00001' if you created a table as 'TBL_DIV_TYPE' which is 12 character long. But the table can be accessed in program using EXEC sql with the name 'TBL_DIV_TYPE' and file can be declared as ' ' TBL_D00001' other db2 application can use the original name. This relation between the DB2 table name and the AS400 file name is maintained or identified in SYSTABLES file DB2 name will be TABLE_NAME and as400 file name will

AS400: Batch Debug

Service Job for Debug: Batch Debug: Hold the job STRSRVJOB on that job strdbg on the program put some break points comeout relase the job   Once the job calls the program in debug will open in debug mode For interactive job Debug: STRSRVJOB on the interactive job STRDBG on the program and put some break points Comeout Then have the users use the screen or something that call the program in debug mode The debug screen will come to your screen for their job.

AS400: Starting AS400 Emailing IBM job

Use command to start the QMSF job (2 jobs may run). This is an essential job for SNDDST to send email. If not running, SNDDST will complete successfully but email wont be sent. Check QMSF jobs in Active job list,  if not running Run below command to start them. If already running, you can kill them and start using below command if needed. STRMSF