× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Adrienne,

It looks as if you are trying to pass a varying number of "value pairs" as
parameters in one parm.  One way to solve the "garbage" included from the
command line processor would be to have a "delimiting" string in your input
parm.  For example if you defined /** as the "end of parm" string the COBOL
program would then know when to stop processing your "value pairs".  Where
"/**" could be any string you can reasonably expect to never be included in
your value pairs.

Sample Code
* * *
      *---------------------------------------------------------------*
       IDENTIFICATION   DIVISION.                                      
       PROGRAM-ID.      TESTPGM3.                                      
       AUTHOR.          DAVID SCOTT.  
       ENVIRONMENT      DIVISION.                                      
       INPUT-OUTPUT     SECTION.                                       
       FILE-CONTROL.                                                   
       DATA DIVISION.                                                  
       FILE SECTION.                                                   
      *---------------------------------------------------------------*
       WORKING-STORAGE SECTION.                                        
       01          VAR.                                                
         05        VAR-LEN             PIC  S9(03) COMP-3.             
         05        VAR-PARM            PIC  X(1000).                   
      *---------------------------------------------------------------*
       LINKAGE SECTION.                                                
       01          IN-PARM             PIC  X(1000).                   
       PROCEDURE DIVISION            USING  IN-PARM.                   
      *---------------------------------------------------------------*
       000-MAIN.                                                       
           MOVE       ZERO             TO   VAR-LEN                    
           MOVE       SPACES           TO   VAR-PARM                   
           INSPECT    IN-PARM                                          
             TALLYING VAR-LEN          FOR  CHARACTERS BEFORE "/**"    
           IF         VAR-LEN          >    ZERO                       
             MOVE     IN-PARM(1:VAR-LEN)    TO  VAR-PARM               
             DISPLAY  "IN-PARM..: "         IN-PARM(1:100)             
             DISPLAY  "VAR-PARM.: "         VAR-PARM(1:100)            
             DISPLAY  "VAR-LEN..: "         VAR-LEN                    
           ELSE                                                        
             DISPLAY "MISSING PARAMETER DELIMITER"                     
           END-IF                                                      
           GOBACK.                                                     
       000-EXIT.                                                       
           EXIT.                                                       
      *---------------------------------------------------------------*

Example: 

CALL TESTPGM3 PARM('DATE-FR=08/03/06 DATE-TO=08/15/06/**') 

Output:

IN-PARM..: DATE-FR=08/03/06 DATE-TO=08/15/06/**  
      
VAR-PARM.: DATE-FR=08/03/06 DATE-TO=08/15/06               
VAR-LEN..: 033                                             

Hope this helps....


David Scott 
SmartWeb Technology, Inc. 
dlscott@xxxxxxxxxxxxxx
(Voice) 407-671-2277 
(Cell) 407-310-8106 
(Fax) 407-264-6877 


-----Original Message-----
From: cobol400-l-bounces@xxxxxxxxxxxx
[mailto:cobol400-l-bounces@xxxxxxxxxxxx] On Behalf Of Adrienne McConnon
Sent: Friday, August 18, 2006 1:14 PM
To: cobol400-l@xxxxxxxxxxxx
Subject: Re: [COBOL400-L] COBOL400-L Digest, Vol 4, Issue 80

Terry,

Thanks - but I call the program from the command line - I literally type
in:

call z13work/jstatus parm('DATE-FR=08/03/06 DATE-TO=08/15/06')

Is that the problem?  I am trying to pass it 1 parameter within quotes which
I programmatically parse into sepatate components.  I do this because I want
to allow anywhere from 1 to 25 parms to be specified in any order.

Thanks,

Adrienne
 

-----Original Message-----
From: cobol400-l-bounces@xxxxxxxxxxxx
[mailto:cobol400-l-bounces@xxxxxxxxxxxx] On Behalf Of
cobol400-l-request@xxxxxxxxxxxx
Sent: Friday, August 18, 2006 1:00 PM
To: cobol400-l@xxxxxxxxxxxx
Subject: COBOL400-L Digest, Vol 4, Issue 80

Send COBOL400-L mailing list submissions to
        cobol400-l@xxxxxxxxxxxx

To subscribe or unsubscribe via the World Wide Web, visit
        http://lists.midrange.com/mailman/listinfo/cobol400-l
or, via email, send a message with subject or body 'help' to
        cobol400-l-request@xxxxxxxxxxxx

You can reach the person managing the list at
        cobol400-l-owner@xxxxxxxxxxxx

When replying, please edit your Subject line so it is more specific than
"Re: Contents of COBOL400-L digest..."


Today's Topics:

   1.  iSeries COBOL Linkage section/PARM problem (Adrienne McConnon)
   2. Re:  iSeries COBOL Linkage section/PARM problem (Winchester Terry)
   3. Re:  iSeries COBOL Linkage section/PARM problem (Jon Paris)


----------------------------------------------------------------------

message: 1
date: Fri, 18 Aug 2006 08:10:46 -0500
from: "Adrienne McConnon" <Adrienne.McConnon@xxxxxxxxxxxx>
subject: [COBOL400-L] iSeries COBOL Linkage section/PARM problem

Hello all!
 
I am experiencing a problem passing a parameter to a COBOL program.  It
appears that the linkage buffer not only contains the parm I specified,
but 'STATUS    00' as well.  Below is a section of muy code and then the
DSPJOBLOG displays.  I do not understand why that 'STATUS' appears after the
08/15/06 display below.  What am I missing?
 
Thanks,
 
Adrienne McConnon
 
 
 
 
  LINKAGE SECTION.                                                
                                                                  
  01  L-INPUT-PARM         PIC X(1000).                           
                                                                  
  PROCEDURE DIVISION USING L-INPUT-PARM.                          

  0000-BEGIN.                                                     
      DISPLAY '0000-BEGIN'.                                       
                                                                  
      DISPLAY 'L-INPUT-PARM=', L-INPUT-PARM.                      
      PERFORM I000-INIT-RTN THRU I000-END.                        
                                                                  
      PERFORM 0100-PROCESS-PARM THRU                              
              0100-EXIT.                                          
                                                                  
      GO TO 9999-EOJ-RTN.                                         
 

************************************************************************
*****
 
      Display All Messages                              
                                                             System:
MSSAS400 
 Job . . :   QPADEV000C    User . . :   AMCCONNO      Number . . . :
242854   
 

     Member TSTATUS in file ZZB/CBLLE is in use.

     Error found on STRSEU command.

 4 > DSPMSG

 4 > WRKSPLF

 6 > DSPMSG

 6 > call z13work/jstatus parm('DATE-FR=08/03/06 DATE-TO=08/15/06')

     Object PDSPLOG in Z13WORK type *FILE deleted.

     File PDSPLOG created in library Z13WORK.

     Member PDSPLOG added to file PDSPLOG in Z13WORK.

     Object WSTATUS in Z13WORK type *FILE deleted.

     File WSTATUS created in library Z13WORK.

     Member WSTATUS added to file WSTATUS in Z13WORK.

     0000-BEGIN

     L-INPUT-PARM=DATE-FR=08/03/06 DATE-TO=08/15/06 STATUS

 
More... 
     0100-PROCESS-PARM

     LPARM-IN-DATA-REC=DATE-FR=08/03/06 DATE-TO=08/15/06 STATUS

                               00

      PARM-IN-DATA-REC-TABLE=DATE-FR=08/03/06    DATE-TO=08/15/

     06    STATUS

         00

      PARM-IN-DATA (1)=DATE-FR=08/03/06

      PARM-IN-DATA (2)=DATE-TO=08/15/06

      PARM-IN-DATA (3)=STATUS

      PARM-IN-DATA (4)=

      PARM-IN-DATA (5)=

      PARM-IN-DATA (6)=

      PARM-IN-DATA (7)=

 
More... 
 Press Enter to continue.

 

 F3=Exit   F5=Refresh   F12=Cancel   F17=Top   F18=Bottom

 

 

 

 



------------------------------

message: 2
date: Fri, 18 Aug 2006 10:15:27 -0400
from: "Winchester Terry" <terry.winchester@xxxxxxxxxxxxxxx>
subject: Re: [COBOL400-L] iSeries COBOL Linkage section/PARM problem

Adrienne,

It appears that you linkage area is getting corrupted.

Check the calling program (CL, RPG, etc.) and ensure that it is using the
same number of bytes for the parameter -AND- that the parameter area is
being initialized properly before being populated with data prior to the
call to your program.

Terry Winchester
Programmer/Analyst
________________________________
The Raymond Corporation
terry.winchester@xxxxxxxxxxxxxxx 

-----Original Message-----
From: 
cobol400-l-bounces+terry.winchester=raymondcorp.com@xxxxxxxxxx
om
[mailto:cobol400-l-bounces+terry.winchester=raymondcorp.com@mi
drange.com] On Behalf Of Adrienne McConnon
Sent: Friday, August 18, 2006 9:11 AM
To: cobol400-l@xxxxxxxxxxxx
Subject: [COBOL400-L] iSeries COBOL Linkage section/PARM problem

Hello all!
 
I am experiencing a problem passing a parameter to a COBOL program.  
It appears that the linkage buffer not only contains the parm I 
specified,
but 'STATUS    00' as well.  Below is a section of muy code 
and then the
DSPJOBLOG displays.  I do not understand why that 'STATUS' 
appears after
the 08/15/06 display below.  What am I missing?
 
Thanks,
 
Adrienne McConnon
 
 
 
 
  LINKAGE SECTION.                                                
                                                                  
  01  L-INPUT-PARM         PIC X(1000).                           
                                                                  
  PROCEDURE DIVISION USING L-INPUT-PARM.                          

  0000-BEGIN.                                                     
      DISPLAY '0000-BEGIN'.                                       
                                                                  
      DISPLAY 'L-INPUT-PARM=', L-INPUT-PARM.                      
      PERFORM I000-INIT-RTN THRU I000-END.                        
                                                                  
      PERFORM 0100-PROCESS-PARM THRU                              
              0100-EXIT.                                          
                                                                  
      GO TO 9999-EOJ-RTN.                                         
 

**************************************************************
**********
*****
 
      Display All Messages                              
                                                             System:
MSSAS400 
 Job . . :   QPADEV000C    User . . :   AMCCONNO      Number . . . :
242854   
 

     Member TSTATUS in file ZZB/CBLLE is in use.

     Error found on STRSEU command.

 4 > DSPMSG

 4 > WRKSPLF

 6 > DSPMSG

 6 > call z13work/jstatus parm('DATE-FR=08/03/06 DATE-TO=08/15/06')

     Object PDSPLOG in Z13WORK type *FILE deleted.

     File PDSPLOG created in library Z13WORK.

     Member PDSPLOG added to file PDSPLOG in Z13WORK.

     Object WSTATUS in Z13WORK type *FILE deleted.

     File WSTATUS created in library Z13WORK.

     Member WSTATUS added to file WSTATUS in Z13WORK.

     0000-BEGIN

     L-INPUT-PARM=DATE-FR=08/03/06 DATE-TO=08/15/06 STATUS

 
More... 
     0100-PROCESS-PARM

     LPARM-IN-DATA-REC=DATE-FR=08/03/06 DATE-TO=08/15/06 STATUS

                               00

      PARM-IN-DATA-REC-TABLE=DATE-FR=08/03/06    DATE-TO=08/15/

     06    STATUS

         00

      PARM-IN-DATA (1)=DATE-FR=08/03/06

      PARM-IN-DATA (2)=DATE-TO=08/15/06

      PARM-IN-DATA (3)=STATUS

      PARM-IN-DATA (4)=

      PARM-IN-DATA (5)=

      PARM-IN-DATA (6)=

      PARM-IN-DATA (7)=

 
More... 
 Press Enter to continue.

 

 F3=Exit   F5=Refresh   F12=Cancel   F17=Top   F18=Bottom


Confidentiality Notice:

The preceding e-mail message (including any attachments) contains
information that may be confidential, protected by applicable legal
privileges, or constitute non-public information. It is intended to be
conveyed only to the designated recipient(s). If you are not an intended
recipient of this message, please notify the sender by replying to this
message and then delete it from your system. Use, dissemination,
distribution or reproduction of this message by unintended recipients is not
authorized and may be unlawful.






------------------------------

message: 3
date: Fri, 18 Aug 2006 11:10:36 -0400
from: "Jon Paris" <Jon.Paris@xxxxxxxxxxxxxx>
subject: Re: [COBOL400-L] iSeries COBOL Linkage section/PARM problem

In simple terms your problem is that you called the program from the command
line and the system had to make an assumption about how big to make the
temporary storage that will hold the parm value.

Your parm of "DATE-FR=08/03/06 DATE-TO=08/15/06' is (if I counted
correctly)
33 characters long - therefore that is how much storage is assigned.

In your program you treat the parm as being 1,000 bytes - so you're going to
see garbage in the storage beyond 33 bytes. 

If you really want to call the program directly from the command line, then
to ensure the length you require you will need to use command to make the
call.

Susan and I just published a piece on this called "The Mystery of Command
Line Parameters" on this subject if you want more details.  It is not yet
available on the magazine's web site, but if you e-mail me privately I will
send you a copy.



Jon Paris
Partner400

www.Partner400.com 




------------------------------

--
This is the COBOL Programming on the iSeries/AS400 (COBOL400-L) digest list
To post a message email: COBOL400-L@xxxxxxxxxxxx To subscribe, unsubscribe,
or change list options,
visit: http://lists.midrange.com/mailman/listinfo/cobol400-l
or email: COBOL400-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at http://archive.midrange.com/cobol400-l.



End of COBOL400-L Digest, Vol 4, Issue 80
*****************************************



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.