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.

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 :


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     …
Hi All, I need to create a lf over a pf that has 5 members. When I go to execute the creation, I get a DDS error relating to the severity level indicated. I feel like I'm doing something fundimentally wrong creating the file. Can someone give me the steps to create a LF. do I need to create a member first because that's where I feel like I'm getting hung up.

Thanks for your help in advance.

Hi Experts,

We have on our IBM iSeries Server (as/400), some https: connections, that make use of the default kesystore:

Now we have several environments Development, test1, test2, acceptation, production1 etc.
Is is advisable to make a keystore for each environment with each their own authorization?)
Hi Experts,

I have Generate the sources for a webservice with the default string length of 128.
In the service there is one element that have  to contain  base64 data so 128 pos it to small,
So I like to set the the size of only 1 field to 16384 (or even more).

Therefore I tried to copy the  xsd_string definition to a  xsd_Lstring definition and changed the value entry to a larger number.
After that I changes all required likeds(xsd_string) into xsd_Lstring  (I think i did, but probably I missed one or more)
Then recreated the Service-program.
I understand what is wrong, but can't find where to change that.

Whatever I try I keep the error:

Message RNQ0202
The call to stub_op_M1 ended in error (C G D F).
Cause . . . . . :   RPG procedure TRNS001R in program KWNPGM61/TRNS001R at    
  statement 3456 called program or procedure stub_op_M1, which ended in error.
  If the name is *N, the call was a bound call by procedure pointer.          
Recovery  . . . :   Check the job log for more information on the cause of the
  error and contact the person responsible for program maintenance.          

more info (f10)

Message: RNX0115
Message . . . . :   Length of varying length variable is out of range.      
Cause . . . . . :   The length of a varying length character or DBCS variable
  is less than 0 or greater than its declared maximum length in RPG procedure
  XSD_STRING in program KWNPGM61/TRANSUS01.                                  
Recovery  . .…
Hi, I was wondering if there was a command on the AS/400 where I can view all the options/menus that an individual has access to.  I need to ensure that another user that has already been setup, has the same access as another user.  I would just recopy the profile over; however, this user has already started to do work and I don't want to screw things up for them.

Any information would be appreciated.

Hello Experts

A print device was deleted by accident and was working.  Now I can't figure how to set up the print device Okidata Dot Matrix LAN printer on the AS/400 again.  

Any help would be appreciated.  Thanks!

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!