HP3000-L Archives

February 2006, Week 4

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Francois Desrochers <[log in to unmask]>
Reply To:
Francois Desrochers <[log in to unmask]>
Date:
Wed, 22 Feb 2006 07:53:32 -0600
Content-Type:
text/plain
Parts/Attachments:
text/plain (101 lines)
Rakesh,

Two things:

- I think you should define MDELIM1 and MDELIM2 as PIC X, not PIC 9.
- Decimal 28 is %34, not %35.

The Cobol compiler may be changing %34 to the decimal equivalent and then assigning it to the variables. This would be similar to

  05 MDELIM1  PIC 9 VALUE 28.

You probably can see where this may lead to problems. I'm curious. What do you see in the current program. Would you happen to see the number "8" ("9" in your case since you incorrectly used %35) where you would expect the delimiter?

François

-----Original Message-----
From: HP-3000 Systems Discussion [mailto:[log in to unmask]] On Behalf Of Rakesh Kumar Velchuri
Sent: Wednesday, February 22, 2006 8:34 AM
To: [log in to unmask]
Subject: [HP3000-L] Regarding decimal 28 as delimiter.

Please look at the code that we have written t
  
Hello Sir/Madam,

Please look at the code that we have written to include decimal 28 as one of the delimiter that separates the data in a file. We were not able to get the character plugged in the output file (as was desired). Can you please look at the code and tell us as to where we are going wrong.

Thanks in advance for your help.

We have have used %35 as deimal 28.

Sample Code
-------------------------------------------------------------------
                                                     
IDENTIFICATION DIVISION.                             
PROGRAM-ID.     HELLOWORLD.                          
                                                     
                                                     
ENVIRONMENT DIVISION.                                
INPUT-OUTPUT SECTION.                                
FILE-CONTROL.                                        
SELECT StudentFile ASSIGN TO "STUDENTS"              
            ORGANIZATION IS LINE SEQUENTIAL.         
                                                     
DATA DIVISION.                                       
FILE SECTION.                                        
FD StudentFile.                                      
01 StudentDetails.                                   
   02  StudentId       PIC 9(7).                     
   02  DELIM1          PIC X.                        
   02  StudentName.                                  
       03 Surname      PIC X(8).                     
       03 Initials     PIC XX.                       
   02  DELIM2          PIC X.                        
   02  Gender          PIC X.                        
WORKING-STORAGE SECTION.                             
01 MStudentDetails.                                  
   02  MStudentId       PIC 9(7).                    
   02  MDELIM1          PIC 9 VALUE %35.             
   02  MStudentName.                                 
       03 MSurname      PIC X(8).                    
       03 MInitials     PIC XX.                      
   02  MDELIM2          PIC 9 VALUE %35.             
   02  MGender          PIC X.                       
                                                     
                                                     
                                                     
PROCEDURE DIVISION.                                  
BEGIN.                                               
    OPEN OUTPUT StudentFile                          
    DISPLAY "Enter student details using temp below" 
    PERFORM GetStudentDetails                        
    PERFORM UNTIL MStudentID = 0                     
     MOVE MSTUDENTDETAILS TO STUDENTDETAILS          
     WRITE STUDENTDETAILS                            
     PERFORM GetStudentDetails                       
    END-PERFORM                                      
    CLOSE StudentFile                                
STOP RUN.                                            
GetStudentDetails.                                   
    DISPLAY "ENTER STU ID ".                         
    ACCEPT  MSTUDENTID.                              
    DISPLAY "ENTER STUDENT NAME."                    
    ACCEPT MSTUDENTNAME.                             
    DISPLAY "ENTER GENDER"                           
    ACCEPT MGENDER.                                  


Rakesh Kumar Velchuri(Rox)

Assistant System Engineer (Trainee)
Tata Consultancy Serices
HP Centre,
Chennai,India.

* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *

* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *

ATOM RSS1 RSS2