Set error 22: No such path or directory

Discussions related to HTTPAPI (An HTTP Client Package for RPG programming.) http://www.scottklement.com/httpapi/
Post Reply
muzouka
Posts: 3
Joined: Tue Dec 20, 2022 6:05 am

Set error 22: No such path or directory

Post by muzouka »

We are using HTTPAPI version 1.40 to get some data from a url but keep getting a "SetError() £22: open(): No such path or directory." message.

This is the entirety of the log:
HTTPAPI Ver 1.40 released 2019-08-15
NTLM Ver 1.4.0 released 2014-12-22
OS/400 Ver V7R3M0

2025-02-06-08.26.04.112000: New iconv() objects set, PostRem=819. PostLoc=0. ProtRem=819. ProtLoc=0
2025-02-06-08.26.04.112000: SetError() £22: open(): No such path or directory.
2025-02-06-08.26.04.130000: SetError() £22: open(): No such path or directory.
2025-02-06-08.26.04.130000: SetError() £22: open(): No such path or directory.
Below are the relevant parts of the source code. The program runs as part of an AS400 job and coded using RPG.
The data area contains

Code: Select all

*Declaration of data area structure
DDDTAARA          DS                  DTAARA(DTAKP01A0)
DDTAINFO                  1     49                     
DDTAURL                  50    149                     
DDTAAPIKEY              150    199                     
DDTALOG                 200    200                     
DDTALCK                 201    201                     
DDTAIFS                 202    221                     
DDTAIFS2                222    241                     
DDTAFILLER              242    512                     

*This is the actual code that sends the request.
begsr send_KPB;                                          
 callp http_debug(*ON: %trimr(dtaifs) + SERVER + '.txt');
                                                         
 http_setOption( 'content-type'                          
              : 'application/json');                     
                                                         
 http_xproc( HTTP_POINT_ADDL_HEADER                      
           : %paddr(ADDHEADER));                         
                                                         
 RC      = http_req('PATCH'                              
         : %trimr(DTAURL) + %trimr(EID)             
         : %trimr(DTAIFS2) + server + '.txt'             
         : *omit                                         
         : *omit                                         
         : JSONDATA);                                    
                                                         
 http_error(err:httpret);                                
                           
   if RESEND = 'N';        
      if RC  = 1           
      or RC  = 201;        
         PRC = '1';        
         TDATE = %date();  
         TTIME = %time();  
      else;                
         PRC = '0';        
         exsr write_Error; 
         exsr send_Retry;  
         RESEND = 'N';     
      endif;               
   endif;                  
                           
   if RESEND = 'Y';        
      if RC  = 1           
     or RC  = 201;      
        PRC = '1';      
     else;              
      PRC   = '0';      
     endif;             
   exsr update_Error;   
   if F3KERREL   = 0;   
      exsr send_Retry;  
   endif;               
  endif;                
                        
  if (RC    = 1         
  or  RC    = 201)      
  and DTALOG = 'Y';     
   exsr log_Success;    
  endif;                
 endsr;      
We have the same program in our test environment and it works well, the only difference is the API Key. The test environment is in the same partition as the production environment but the library list points to the test libraries.

We also have the same program and setup in another partition, including the API key, and we don't have any problems there either. We only have problems with one specific partition.
Scott Klement
Site Admin
Posts: 856
Joined: Sun Jul 04, 2021 5:12 am

Re: Set error 22: No such path or directory

Post by Scott Klement »

You have this in your code:

Code: Select all

%trimr(DTAIFS2) + server + '.txt'    
Whatever you are providing there isn't a valid path or directory in the IFS.
Post Reply