We help IT Professionals succeed at work.

IBM System i

IBM i, formerly known as AS/400, is a proprietary, midrange, object-based operating and application system. It includes a relational database, a menu-driven interface, support for multiple users, block-oriented terminal support and printers, and supports security, communications, and web-based application servers including Websphere, Apache and Tomcat.

Hello Experts.   Does anyone remember how to check if there is data in a file and if no data GOTO  to a TAG using s36 OCL command?   Thanks!
Hi Experts,

On our IBMi (aka as/400) I try to run a Qshell command:
/QIBM/ProdData/OS/WebServices/bin/installWebService.sh .....etc

As return I get a message :
001-0014 Command /QOpenSys/QIBM/ProdData/JavaVM/jdk70/32bit/bin/java not found.

which is odd, because I run Java version "1.8.0_171"
So I expect that I should use jdk80.?

Where can ik configure this?

I am creating and writing to an IFS File and want the file to be written in ASCII format.  I am using the C "open" and "write" APIs.  Here is the text I am using to create the file.

                 + O_TRUNC + O_TEXT_CREAT;
         mode = S_IRWXU;                  // Grant the Owner full rights
         mode += S_IRGRP + S_IWGRP;       // Grant Owner's Group Read and Exec rights
         mode += S_IROTH + S_IWOTH;       // Grant all others Read and Exec rights

         // Create the IFS File...
         fd = open(%trim(scriptPath):
                         CP_WINDOWS);    // Important for CCSID to be Windows Compliant.
          if fd >= *ZEROS;
           callp close(fd);                // Save to the folder
           scriptIsOpen = *OFF;
           // Now that the file is created, open it for processing.
           flags = O_WRONLY + O_TEXTDATA + O_CCSID;
           fd = open(%trim(scriptPath):
                           CP_WINDOWS);    // Important for CCSID to be Windows Commpliant.

Unfortunately, when I write to the file,  The text is being written as EBCDIC (CCSID = 37)  even though the file is defined with the CCSID set to 1252.

Is it possible to write ASCII text to …
Hello Experts,

I'm trying to write a CL program that will import multiple files from an IFS directory to a physical file but I cannot get it to work.  I can import individual files but I can't figure out the code for multiple files and I don't want a PC batch program to combine files.

Here is the code I have so far.  A little messy but I will clean it up after I get it working.

 MLGIMP:     PGM                                                            
             DCL        VAR(&EOF) TYPE(*LGL) VALUE('0')                      
             DCLF       FILE(TEST/FILELIST)                                  
             CLRPFM     FILE(MLGIMP)                                        
             CLRPFM     FILE(FILELIST)                                      
              DOWHILE (&EOF *EQ '0')                                              
              MONMSG CPF0864 EXEC(CHGVAR…
Hi Experts,

After generating a RPG-source with WSDL2RPG.SH, I have an unknown element.
I like to know why the generator added this and what to do with it.

Simplified Example:
<xsd:element name="Lines" minOccurs="0" maxOccurs="unbounded">
                  <xsd:element name="Line" type="xsd:string"/>

The program generates the variables:

I realy don't know what the .Type field is (it's a Int(10) field), its not part of the wsdl
And I don't know what to do with it (not in the manual)
On this moment I can fill the .Size field with the required repeats, but its excluded from the XML with:

<ns1:Lines xsi:nil="true"></ns1:Lines>

While debuging I see that the elements are filled and the size is set to the required value.
In the logging I checked and  its not part of the XML.
I'm using the SQL view USER_INFO to retrieve user status. The same program is called interactively from the command line and during sign-on. Interactive works great but it fails during the sign-on process.  

Exec SQL                                  
  Select STATUS INTO :CUSSTS              
    From USER_INFO                        

Then I tried the sql below base on an older article by Joe Pluta.  Both behave the same.

 Exec SQL VALUES                                              
   (Select STATUS                                              
     From USER_INFO                                            

Can anyone tell why the sign-on process has issues? Many Thanks!
I need to calculate number of days, adjust it, and then use it to compare on embedded SQL statement. Details attached.  

Thank You in Advance!
Lynn days-calc-with-caveat.docx
Hi Folks,

I've found a ton of logical files from our software vendor on our AS/400 that would be very beneficial for my use.  After investigating further, upon seeing now data in the preview of these files, I noticed that an old member was listed first in the logical with the correct current members listed below it.  When I go to remove the old member, all the data is then showing up in the preview.  Is there a way to change all logical files to ensure they point at a valid member first?
Hi Expert(s),

I got a question about DDI, I remembered that it had something to do with "Distributed Data Interface",
but I can't find good information about it, please can someone point me to the right direction (or manual).
Especialy the What is DDI, not how to configure it.
Hi, I'm trying to retrieve order number, status, customer#, customer name from our order master and customer master when the customer is on our preferred customer file.  This runs but returns nothing when it should.  Where am I going wrong?   Note: CXSPRF is a preferred level then multiple customer are assigned to it.  So I want all custest1 level where the customer number from the order master is assigned to it and active.

Select a.CHONUM,a.CHOSTS,a.CHOCUS,b.CCNAME                              
from CORDER a, CUSTMST b                                        
where a.CHOCUS = b.CCNUM                                        
  and (a.CHODTE between 20190101 and 20190931)                  
  and EXISTS                                                    
                                                                        a.CHOCUS = c.CXSCUS)  AND  
                                                                        c.CXSSTS = 'A'))          

Thank you in advance!!
I'm trying to send a file SFTP for the first time. The receiver says he didn't receive it.
How do I look at the SFTP log for my transmission on IBM i V7R3M0?
QSH JAR command get errors with VARCHAR fields in PF :

at java.io.FileInputStream.read(FileInputStream.java:250)            
        at sun.tools.jar.Main.copy(Main.java:891)                            
        at sun.tools.jar.Main.copy(Main.java:906)                            
        at sun.tools.jar.Main.addFile(Main.java:853)                        
        at sun.tools.jar.Main.create(Main.java:557)                          
        at sun.tools.jar.Main.run(Main.java:226)                            
        at sun.tools.jar.Main.main(Main.java:1300)      

call CMD:
QSH        CMD('JAR cvfM /TestJAR/xxxxxxxx.ZIP -C +      
              /QSYS.LIB/Testlib.LIB/xxxxxxxxx.FILE +    

How to get the Output ZIP-file from PF  with VARCHAR fields ?

PF is  SQL table

"Problem fields" for JAR are defined like this :

 FLD1            CHAR            1       3       184        Both      
    Variable length field -- Allocated length :  None
    Default value . . . . . . . . . . . . . . :  None
     Coded Character Set Identifier  . . . . . :  65535

   FLD2        CHAR           80      82       187        Both    
     Variable length field -- Allocated length :  None
     Allows the null value
    Coded Character Set Identifier  . . . . . :    273
What will happen in the following situation, I can't force this nor test this.

In a process a recordset is selected with SQL with a selection e.g. WHERE CODE = 1
(The result can contain a few hundred records.)
each record will be processed (within 15-30 seconds) and flagged as "CODE = 2"

Now a second job (same program) is started.
This program will also select a recordset with SQL with a selection e.g. WHERE CODE = 1.

What will happen when:
Job 1 select a records with code=1
(e.g result 250 records)

Job 2 select a records with code=1
(e.g result 240 records, 10 already processd by job 1)

Job 1 change value of a record to CODE = 2.
Is this record still in the recordset from Job 2?
Need help with setting up and configuring SFTP on V7M3 IBM i. I have no working knowledge of SFTP but tons of experience using FTP. Appreciate any ides folks! Phil
I have a CL that is using QP2SHELL2 to call an API url and I'm getting error: CPFB9C0 (PASE for i program not found or in use. Path name is......)  .  I have another CL program that works fine and does close the same thing.  What am I missing.

Thanks Experts!
I have multiple search screen which I'm rewriting from 36. (yuck-very old)  I'm adding fields which allow the user to filter the information. Everything is working great, but I figure there has to be a better way.
Currently when the filter criteria changes I declare a the cursor dependent on the criteria selected and reload an array. (I could load the date range only and the selectively load the subfile, however doing this way they may not see all the records because it could exceed the 9999 without all criteria.)  SQL is fast and works great.  It is the cursor definition I have questions on.  Please see attached sample code.  Thank You!
I want to calculate the number of days between days, inclusive of the first date. I want the number of day gone.  So, when the trip departs and returns on the same date I want 1 day.  Should be easy but I keep getting errors. Running interactively.  dates are stored as 8s 0.   Sample code:

select trknbr,                                              
     ((Days(date(rtndte))-Days(date(lvedte))) + 1) as dys,  
  from delivdetl                                                
  where lvedte=20190730

results example:
   123456  +++++++++++++++ 20190730  20190730

Thank You for you assistance!!
I have spool files that I'm trying to copy to a physical file and then have them emailed or at least put out to a network share.  My issue is that there are multiple days with the same filenames for each set of files created for the day.  Please see the attached picture.  I tried the cpysplf; however, it finds there being multiple jobs and cannot distinguish between the different files.  I'd want the job to run each day, in the morning and to pull the last reports.  Any help would be appreciated.  Spool file review.
I am attempting to add additional media to my BRMS configuration. I am using the following command:


Where TAPDDBKP is our Data Domain that we are backing up to.

When I run this, I get the following error:  Command ended due to error

Upon further investigation, I am getting the error: Cartridge A01001 not found

In the help text for this, it shows you can run a ADDTAPCTG command to add cartridges.  If I attempt to do this (ADDTAPCTG DEV(TAPDDBKP) CTG(A01001)), I get the following error: Cartridge A01001 not found

I am not sure what I need to do. Any help would be much appreciated!
How to do a client authentification by dedicated RPGLE, not for all sessions of a client.
(ACS Connection to iSeries is used). Maybe with usage of DCM certificate ?
Hi All,

I have a logical file:  MFWOL100 that sits in production library LOGICLIB and refers back to the physical file MFWOP100 in FLNFILPRD.  I want to copy that logical file and use it in my test environment.  Our test environment is located in the FLNFILTST library and that is also where the MFWOP100 file is located.  The MFWOP100 file is multimember, with M800, M810, M820, M830, and M840.  

What is the best way of copying that logical file and changing the source table so that I can use it in my test environment?  

I've tried this a couple of different ways and I appear to be going around in circles.

Any help would be greatly appreciated.

Hi.  Format of Db2 SQL update statements over joined tables is confusing but I think I have a handle on it.  I'm hoping someone can verify my code before I make an update in my ERP system.    I'm only updating 1 record to start but even so, I want to make sure I have the statement formatted correctly before I even do that.  

Update-ITCLS-a-and-set-to-value-of-.docx  I've attached a partial output of a select statement over my joined tables:  ITEMBL a and ITMRVA b.  There is a 1 - many relationship from table b to table a joined on the ITNBR (multiple House records for each ITNBR record in table b).  Both tables include a field called ITCLS that is manually updated in table b but is not getting updated in table a.  My task is to copy value of table b to table a where the ITNBR matches, regardless of house designation and where a.ITCLS <> b.ITCLS.    (about 2000 records out of 100k or so..

I think this code might do the trick but I'm not 100% sure...  After a test I'd substitute the single itnbr for "AND a.ITNBR = b.ITNBR"

UPDATE amflibx.itembl as a
  SET itcls = 
    (SELECT b.itcls 
        FROM amflibx.itmrva b                                    
        JOIN amflibx.itembl a ON a.itnbr = b.itnbr              
        WHERE a.itcls <> b.itcls AND b.itnbr = 'AN02.5')
 Where exists
    (select * 
        FROM amflibx.itmrva b                                    
        JOIN amflibx.itembl a ON a.itnbr = b.itnbr              
        WHERE a.itcls <> b.itcls AND b.itnbr = 'AN02.5')  

Open in new window

Hi Experts,

From a Web-service I get a return-value, that should be Base64 encoded.
While debugging, I see that it doesn't look like base64, I assume that it is base64 but in ASCII format,
When I look into the logging, I see base 64 data.

If it is ASCII, how do I write that to an IFS-file using the open(::::)
I tried a lot of oFlags and modes and some CCSID's, but can't find the right comination

Current open function:
open(%trim(B64FileName) : O_RDWR + O_CREAT + O_TRUNC + O_CCSID + O_TEXTDATA : S_IRWXU + S_IRWXG + S_IRWXO : 819);
open(%trim(B64FileName):O_RDWR+O_TEXTDATA: S_IRWXU + S_IRWXG + S_IRWXO);

Debug result looks like :

iSeries: I have a screen (pgm a) which calls a window (pgm b) then it call a second window for a search (pgm c) .  When pgm c returns to pgm b, the backgroup and window lines are gone. I've included screen prints.  

Any help is much appreciated.

How to ESCAPE RPG-program in error-case ?

RPG calls some API. if error happens in API-call, RPG program loops,
because of parm-length error.

How to use SDS to avoid looping (escape, without MSG, only leave RPG-pgm) ?
For example :

 I           SDS                                                  
 I                                     *PROGRAM PGNAME            
 I                                     *STATUS  PSTAT              
 I                                      254 263 USER              
0273.00      C                     MOVEL'MSGJOB'  SPC    10                  
0274.00      C                     MOVEL'TSITOOL' SPCLIB 10                  
0275.00      C                     MOVEL'*ALL '   JUSER                      
0276.00      C                     MOVEL'*ALL '   JNAME                      
0277.00      C                     MOVEL'*ALL '   JNUM                        
0278.00      C                     MOVELSPC       USRSPC                      
0279.00      C                     MOVE SPCLIB    USRSPC 20                  
0280.00      C                     Z-ADD2         ANZK                        
0281.00      C                     Z-ADD0101      K1                          
0282.00      C                     Z-ADD1906      K2     …

IBM System i

IBM i, formerly known as AS/400, is a proprietary, midrange, object-based operating and application system. It includes a relational database, a menu-driven interface, support for multiple users, block-oriented terminal support and printers, and supports security, communications, and web-based application servers including Websphere, Apache and Tomcat.

Top Experts In
IBM System i

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