Thank you for your reply, Scott. I must admit this is my first foray into bringing data from the stdin and using yajl. Below is my code that I copied from an existing program, that is working for us, to execute QtmhRdStin() API and I see that the json data does get populated into p_UsrSpcData (UsrSpcData). 
When " docNode = yajl_buf_load_tree(%addr(p_UsrSpcData) : %len(len) : yajl_error);" executes , the yajl_error variable contains:
'lexical error: invalid char in json text.                   '
Would you know what would be causing this error?
* Create User Space Parms                                       
 *                                                               
D QUSCRTUS        PR                  ExtPgm('QUSCRTUS')         
D   usrspc                      20a   const                      
D   attr                        10a   const                      
D   size                        10i 0 const                      
D   initval                      1a   const                      
D   pubauth                     10a   const                      
D   text                        50a   const                      
D   replace                     10a   const options(*nopass)       
D   ErrorCode                32767a   options(*varsize: *nopass)   
 ****************************************************************  
 * Change User Space Attributes                                    
 *                                                                 
D QUSCUSAT        PR                  ExtPgm('QUSCUSAT')           
D   RtnLib                      10A                                
D   UsrSpc                      20A   const                        
D   Attrib                   65535A   const options(*varsize)      
D   ErrorCode                32767A   options(*varsize)            
 ****************************************************************  
D KEY_AUTO_EXT    C                   const(3)                     
D AutoExt         DS                  qualified                    
D   NbrRec                      10I 0 inz(1)                       
D   Key                         10I 0 inz(KEY_AUTO_EXT)            
D   Len                         10I 0 inz(%size(AutoExt.Data))     
D   Data                         1A   inz(*ON)                     
 ****************************************************************  
 * Delete User Space                                               
 *                                                                 
D QUSDLTUS        PR                  ExtPgm('QUSDLTUS')          
D   usrspc                      20a   const                       
D   ErrorCode                32767a   options(*varsize)           
 **************************************************************** 
 * Retrieve Pointer to User Space                                 
 *                                                                
D QUSPTRUS        PR                  ExtPgm('QUSPTRUS')          
D   usrspc                      20a   const                       
D   pointer                       *                               
D   ErrorCode                32767a   options(*varsize:*nopass)   
                                                                  
 * Read StdIn                                                     
 *                                                                
D QtmhRdStin      PR                  extproc('QtmhRdStin')       
D    result                       *   value                       
D    resultsize                 10i 0 const                       
D    resultlen                  10i 0                             
D    ErrorCode               32767a   options(*varsize)           
                                                                  
D Kaboom          ds                  qualified                    
D   bytesProv                   10i 0 inz(0)                
D   bytesAvail                  10i 0 inz(0)                
                                                            
D Ignore          ds                  qualified             
D   bytesProv                   10i 0 inz(%size(Ignore))    
D   bytesAvail                  10i 0 inz(0)                
                                                            
D MAXSPACE        c                   const(16766704)       
D USRSPC          c                   'JSONDATA  QTEMP'     
D rtnlib          s             10a                         
D len             s             10i 0                       
D p_UsrSpcData    s               *                         
D UsrSpcData      s           3000A   BASED(p_UsrSpcData)   
  // YAJL Variables                                     
D docNode         S                   like(yajl_val)    
D node            S                   like(yajl_val)    
D val             S                   like(yajl_val)    
D yajl_error      S            500A   varying           
D errMsg          S            500A   varying  
     // ------------------------------------------  
     // Delete user space (if it exists) with the   
     // QUSDLTUS API.                               
     //                                             
     // Then create one, 512k to start with.        
     // Initialize user space with blanks.          
     // XML-INTO will choke on the x'00' character. 
     // ------------------------------------------  
                                                    
     QUSDLTUS( USRSPC: Ignore );   
	 
     QUSCRTUS( USRSPC                                 
             : 'JSON'                                 
             : 512 * 1024                             
             : ' '                                    
             : '*EXCLUDE'                             
             : 'User Space to Contain JSON'           
             : '*NO'                                  
             : Kaboom );                              
                                                      
     // ------------------------------------------    
     // Mark user space for auto-extension with       
     // the QUSCUSAT API.  This way, if more than     
     // 512k is needed, the system will expand the    
     // user space automatically. (up to 16 MB)       
     //                                               
     // Then use QUSPTRUS to get a pointer to it.     
     // ------------------------------------------    
	 
     // ------------------------------------------ 
     // Mark user space for auto-extension with    
     // the QUSCUSAT API.  This way, if more than  
     // 512k is needed, the system will expand the 
     // user space automatically. (up to 16 MB)    
     //                                            
     // Then use QUSPTRUS to get a pointer to it.  
     // ------------------------------------------ 
                                                   
     QUSCUSAT( RtnLib                              
            : USRSPC                               
            : 'JSON'                             
            : 512 * 1024                         
            : ' '                                
            : '*EXCLUDE'                         
            : 'User Space to Contain JSON'       
            : '*NO'                              
            : Kaboom );                          
                                                 
    // ------------------------------------------
    // Mark user space for auto-extension with   
    // the QUSCUSAT API.  This way, if more than 
    // 512k is needed, the system will expand the
    // user space automatically. (up to 16 MB)   
    //                                           
    // Then use QUSPTRUS to get a pointer to it. 
    // ------------------------------------------
                                                 
    QUSCUSAT( RtnLib                             
           : USRSPC                              
            : AutoExt                            
             : Kaboom );                          
                                                  
     QUSPTRUS( USRSPC                             
             : p_UsrSpcData );                    
                                                  
     // ------------------------------------------
     //  Read all of the data sent via STDIN      
     //  into the user space.                     
     // ------------------------------------------
                                                  
       QtmhRdStin( p_UsrSpcData                   
                 : MAXSPACE                       
                 : len                            
                 : Kaboom );                      
				 
  docNode = yajl_buf_load_tree(%addr(p_UsrSpcData): %len(len) 
            :yajl_error);                                     
Moses Nang
Senior Programmer Analyst
O: 847.583.3712
Integrated Merchandising Solutions, LLC
8338 Austin Avenue, Morton Grove, IL 60053
imsretail.com
-----Original Message-----
From: MIDRANGE-L <midrange-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Scott Klement
Sent: Friday, October 16, 2020 11:08 AM
To: midrange-l@xxxxxxxxxxxxxxxxxx
Subject: Re: Saving Stdin to a variable using YAJL
Hello,
yajl_stdin_load_tree() provides an option that can be used to write it to a file.  This is one of the parmeters you pass to the procedure...
If you want to put it into a variable instead of a file, what you would do is:
1) Read stdin yourself with the QtmhRdStin() API from IBM.   Use this to load it into a variable.
2) Write your variable to the log file.
3) Pass the variable to yajl_string_load_tree (or yajl_buf_load_tree if that works better)
-SK
On 10/15/2020 5:56 PM, Moses Nang (IMS Morton Grove) wrote:
Prior to parsing the json data that is in the stdin using yajl_stdin_load_tree, is there a way for me to move the complete json data (i.e. name/value pairs, curly braces, square brackets, etc.) to one variable before I parse the data into the child nodes. I eventually want to save that "raw" json data to a field in log table.
Thanks,
Moses Nang
This email is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential or otherwise protected from disclosure. Dissemination, distribution, or copying of this email or the information herein by anyone other than the intended recipient, or an employee or agent responsible for delivering the message to the intended recipient, is prohibited. If you have received this email in error, please immediately notify us by calling our Network Operations Center at +1 888 697 2443.
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: 
https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.midrange.com_mailman_listinfo_midrange-2Dl&d=DwIGaQ&c=HdAUNv_EOZyljLc1cjbHCq-Eo7r1kRHoywhQbi81uaA&r=plwzSnPr1sMa1fbV3MlyeM8kmnaHf_byXhkFw-499P8&m=EMsHU0KI_z0ju4ppFQMsIhGnLhf5jlr7v5aBM8UsIXs&s=Qgv_764NrSMzeuraN93vCVHJKT0g3IwlHXFFBQohoik&e=
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at 
https://urldefense.proofpoint.com/v2/url?u=https-3A__archive.midrange.com_midrange-2Dl&d=DwIGaQ&c=HdAUNv_EOZyljLc1cjbHCq-Eo7r1kRHoywhQbi81uaA&r=plwzSnPr1sMa1fbV3MlyeM8kmnaHf_byXhkFw-499P8&m=EMsHU0KI_z0ju4ppFQMsIhGnLhf5jlr7v5aBM8UsIXs&s=WrczXUE9enGtVsVpbHfcc_4EVpPAuCpMjIprDgM1T4I&e= .
Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.
Help support midrange.com by shopping at amazon.com with our affiliate link: 
https://urldefense.proofpoint.com/v2/url?u=https-3A__amazon.midrange.com&d=DwIGaQ&c=HdAUNv_EOZyljLc1cjbHCq-Eo7r1kRHoywhQbi81uaA&r=plwzSnPr1sMa1fbV3MlyeM8kmnaHf_byXhkFw-499P8&m=EMsHU0KI_z0ju4ppFQMsIhGnLhf5jlr7v5aBM8UsIXs&s=xCap4OlL73fXA-ozsrjBlflvDIDxuZ25eAn4bue11wE&e= 
As an Amazon Associate we earn from qualifying purchases.