IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

PARM field showing Junk value


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
chatterjesis

New User


Joined: 31 Aug 2008
Posts: 31
Location: hyderabad

PostPosted: Fri Mar 18, 2011 11:23 am
Reply with quote

Hi,

Thanks to all for the kind reply.

Here is the JCL

Code:


                         
//STEP1 EXEC PGM=DISPARM,                                   
//             PARM='MYDDNME'                                 
//STEPLIB DD ..........
//IN1 DD   DSN=infile,         
//         DISP=OLD                                           
//OUT1 DD  DSN=outfile,DISP=MOD                   
        //SYSPRINT DD SYSOUT=*                                       
//SYSUDUMP DD SYSOUT=*                                       
//CEEDUMP DD SYSOUT=*         



Cobol code:
Code:


   WORKING-STORAGE SECTION.                                 
  01 MESSAGE-TEXT.                                         
     05 FILLER             PIC X(10) VALUE 'TABLE : '.     
     05 WS-PARM-DATA       PIC X(100).                     
     05 FILLER             PIC X(10) VALUE 'COUNT : '.     
     05 WS-COUNT           PIC 9(5) VALUE 0.               
  01 WS-LENGTH             PIC 9(3).                       
  77 WS002-FILE-STATUS     PIC X(2)  VALUE  SPACES.         
  77 WS001-FILE-STATUS     PIC X(2)  VALUE  SPACES.         
  01 EOF                   PIC X(5)  VALUE  'FALSE'.       
  01 FILE-REC              PIC X(130).                     
  LINKAGE SECTION.                                         
  01  PARM-BUFFER.                                         
      05  PARM-LENGTH         pic S9(4) BINARY.             
      05  PARM-DATA           pic X(100).                   
  PROCEDURE DIVISION USING PARM-BUFFER.                         
  INITIAL-PARA.                                                 
      INITIALIZE WS-PARM-DATA.                                   
  PARA-1.                                                       
      DISPLAY 'PARM-LENGTH:  ' PARM-LENGTH.                     
      DISPLAY 'PARM-DATA IS: ' PARM-DATA (1 :                   
      PARM-LENGTH).                                             
      MOVE PARM-LENGTH            TO  WS-LENGTH .               
      DISPLAY '  WS-LENGTH: '  WS-LENGTH .                       
      MOVE SPACES                 TO  WS-PARM-DATA .             
      MOVE PARM-DATA (1 : PARM-LENGTH)                           
                                            TO  WS-PARM-DATA .   
      DISPLAY 'WS-PARM-DATA: ' WS-PARM-DATA.                     
  PARA-2.                                                       
      OPEN EXTEND FILE2.                                         
      OPEN INPUT TRANS-FILE.                                     
      READ TRANS-FILE AT END MOVE 'TRUE' TO EOF                 
      IF WS001-FILE-STATUS  = 00                                 
         DISPLAY "File READ STARTED." 
       CONTINUE                                 
    ELSE                                         
       DISPLAY "WS-ERROR While reading file"     
    END-IF.                                     
    PERFORM UNTIL EOF = 'TRUE'                   
      ADD 1 to WS-COUNT                         
      READ TRANS-FILE AT END MOVE 'TRUE' TO EOF 
      END-READ                                   
    END-PERFORM.                                 
    MOVE MESSAGE-TEXT TO FILE-REC               
    WRITE FILE2-DET FROM FILE-REC               
    IF WS002-FILE-STATUS  = 00                   
       DISPLAY "File WRITTEN SUCCESSFULLY."     
       CONTINUE                                 
    ELSE                                         
       DISPLAY "WS-ERROR While WRITING file"     
    END-IF.                                     
    CLOSE FILE2.                                 
    STOP RUN.                                   



output:

Code:

PARM-LENGTH:  00010                             
PARM-DATA IS:                                   
  WS-LENGTH: 010                                 
WS-PARM-DATA:                                   
File WRITTEN SUCCESSFULLY.                       
******************************** BOTTOM OF DATA *



All of them are from one run.
Back to top
View user's profile Send private message
don.leahy

Active Member


Joined: 06 Jul 2010
Posts: 765
Location: Whitby, ON, Canada

PostPosted: Fri Mar 18, 2011 5:22 pm
Reply with quote

Why is PARM-LENGTH being displayed as 5 digits instead of 4?
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Fri Mar 18, 2011 7:26 pm
Reply with quote

Don,

Perhaps (maybe) depending on the TRUNC compile option or maybe not?

Signed-Halfwords have a maximum value of decimal 32767.

In any case, I think we're all still perplexed as to why this entire exercise isn't working correctly....

Bill
Back to top
View user's profile Send private message
don.leahy

Active Member


Joined: 06 Jul 2010
Posts: 765
Location: Whitby, ON, Canada

PostPosted: Fri Mar 18, 2011 8:16 pm
Reply with quote

You're right Bill. When I changed my test pgm to use TRUNC(BIN) it DISPLAYs PARM-LENGTH as 5 digits.

However, that had no influence on the test results; my program still works as expected.
Back to top
View user's profile Send private message
Ronald Burr

Active User


Joined: 22 Oct 2009
Posts: 293
Location: U.S.A.

PostPosted: Fri Mar 18, 2011 9:24 pm
Reply with quote

My first question would be: Is the program doing the displays being invoked DIRECTLY from the JCL, or is it being called by another program?
Back to top
View user's profile Send private message
don.leahy

Active Member


Joined: 06 Jul 2010
Posts: 765
Location: Whitby, ON, Canada

PostPosted: Fri Mar 18, 2011 10:42 pm
Reply with quote

Ronald Burr wrote:
My first question would be: Is the program doing the displays being invoked DIRECTLY from the JCL, or is it being called by another program?
Excellent question. I've been assuming that it is the top level module because that's usually the only program that you'd pass a PARM to.
Back to top
View user's profile Send private message
chatterjesis

New User


Joined: 31 Aug 2008
Posts: 31
Location: hyderabad

PostPosted: Sat Mar 19, 2011 10:15 am
Reply with quote

@Ronald
The JCL directly calls the program...and displays could be seen in SYSOUT
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Sat Mar 19, 2011 9:28 pm
Reply with quote

Oops. Deleted by sender.
Back to top
View user's profile Send private message
chatterjesis

New User


Joined: 31 Aug 2008
Posts: 31
Location: hyderabad

PostPosted: Sun Mar 20, 2011 9:12 pm
Reply with quote

Hi all,

Thanks a lot for your help!!!
The problem got resolved.
I was doing compilation in changeman with CICS option Y.
may be that was the reason PARM was not passing correctly
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Sun Mar 20, 2011 10:57 pm
Reply with quote

Oy Vey icon_rolleyes.gif

Bill
Back to top
View user's profile Send private message
don.leahy

Active Member


Joined: 06 Jul 2010
Posts: 765
Location: Whitby, ON, Canada

PostPosted: Sun Mar 20, 2011 11:09 pm
Reply with quote

That is disappointing. I was hoping that it would be something interesting. icon_sad.gif
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Apr 07, 2011 3:15 am
Reply with quote

I realise this has already gone on longer than it should. But the following should work, without recourse to "reference modification".


Code:


LINKAGE SECTION.                                         
01  PARM-BUFFER.                                         
    05  PARM-LENGTH         pic S9(4) COMP.               
    05  PARM-DATA.
          10  FILLER              PIC X
                OCCURS 1 TO 100 TIMES
                DEPENDING ON PARM-LENGTH.
PROCEDURE DIVISION USING PARM-BUFFER.                     
PARA-1.                                                   
    DISPLAY PARM-DATA.                                   
    DISPLAY PARM-LENGTH.                                 
    MOVE PARM-DATA TO WS-PARM-DATA.


I removed the spurious "INITIALISE", which was also a couple of times mimicked by "MOVE SPACES". There is no point in moving something to a field, and then immediately moving something else. In this instance it is hardly a case of saving CPU time, but some poor prog at some time is going to look at the code and wonder "what's all this abaht?"

Robert got it right, no "reference modification" at all needed on WS-PARM-DATA, even in the examples with "reference modification" for the source field.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming Goto page Previous  1, 2

 


Similar Topics
Topic Forum Replies
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts JCL EXEC PARM data in C Java & MQSeries 2
No new posts Need to specify PARM='POSIX(ON) Java & MQSeries 4
No new posts How to pass the PARM value to my targ... COBOL Programming 8
Search our Forums:

Back to Top