what is difference the cobol between mainframe and pc?



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

what is difference the cobol between mainframe and pc?

Postby lxw039 » Mon Oct 13, 2008 9:44 am

hi, there
I just got the job for mainframe one month ago. I learned cobol 2 years ago,
I want practice the cobol programming in mainframe, my program work correctly in pc, when I compiled
the program in mainframe, It also passed, but run it , the output is totally different, anybody know why?
maybe some syntax different between pc and mainframe, anybody can help me? thank you!
lxw039
 
Posts: 47
Joined: Tue Oct 07, 2008 11:49 pm
Has thanked: 0 time
Been thanked: 0 time

Re: what is difference the cobol between mainframe and pc?

Postby dick scherrer » Mon Oct 13, 2008 9:54 am

Hello,

I just got the job for mainframe one month ago
Congratulations :)

Two major differences between the pc and the mainframe are the operating environment and the collating sequence.

From what you have posted, it is doubtful that we can help. . .
the output is totally different, anybody know why
If you post what is different someone should be able to help or request more info so we can help.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: what is difference the cobol between mainframe and pc?

Postby lxw039 » Tue Oct 14, 2008 7:03 pm

hi, thanks for your help, this is cobol source code as following:

IDENTIFICATION DIVISION.
*
PROGRAM-ID. CALC1000.
*
ENVIRONMENT DIVISION.
*
INPUT-OUTPUT SECTION.
*
DATA DIVISION.
*
FILE SECTION.
*
WORKING-STORAGE SECTION.
*
77 END-OF-SESSION-SWITCH PIC X VALUE "N".
77 SALES-AMOUNT PIC 9(5)V99.
77 SALES-TAX PIC Z,ZZZ.99.
*
PROCEDURE DIVISION.
*
000-CALCULATE-SALES-TAX.
*
PERFORM 100-CALCULATE-ONE-SALES-TAX
UNTIL END-OF-SESSION-SWITCH = "Y".
DISPLAY "END OF SESSION.".
STOP RUN.
*
100-CALCULATE-ONE-SALES-TAX.
*
DISPLAY "-----------------------------------------------".
DISPLAY "TO END PROGRAM, ENTER 0.".
DISPLAY "TO CALCULATE SALES TAX, ENTER THE SALES AMOUNT.".
ACCEPT SALES-AMOUNT.
IF SALES-AMOUNT = ZERO
MOVE "Y" TO END-OF-SESSION-SWITCH
ELSE
COMPUTE SALES-TAX ROUNDED =
SALES-AMOUNT * .0785
DISPLAY "SALES TAX = " SALES-TAX.


the output in pc (OS: windows xp)----everything is ok:

-----------------------------------------------
TO END PROGRAM, ENTER 0.
TO CALCULATE SALES TAX, ENTER THE SALES AMOUNT.

100.00
SALES TAX = 7.85
-----------------------------------------------
TO END PROGRAM, ENTER 0.
TO CALCULATE SALES TAX, ENTER THE SALES AMOUNT.

10.00
SALES TAX = .79
-----------------------------------------------
TO END PROGRAM, ENTER 0.
TO CALCULATE SALES TAX, ENTER THE SALES AMOUNT.

29.99
SALES TAX = 2.35
-----------------------------------------------
TO END PROGRAM, ENTER 0.
TO CALCULATE SALES TAX, ENTER THE SALES AMOUNT.

0
END OF SESSION.



the output in mainframe(OS: mvs/os/390), run under tso---what's wrong with it?:


-----------------------------------------------
TO END PROGRAM, ENTER 0.
TO CALCULATE SALES TAX, ENTER THE SALES AMOUNT.
100
SALES TAX = 785.00
-----------------------------------------------
TO END PROGRAM, ENTER 0.
TO CALCULATE SALES TAX, ENTER THE SALES AMOUNT.
10
SALES TAX = 785.00
-----------------------------------------------
TO END PROGRAM, ENTER 0.
TO CALCULATE SALES TAX, ENTER THE SALES AMOUNT.
29
SALES TAX = 2,276.50
-----------------------------------------------
TO END PROGRAM, ENTER 0.
TO CALCULATE SALES TAX, ENTER THE SALES AMOUNT.
0
SALES TAX = .00
-----------------------------------------------
TO END PROGRAM, ENTER 0.
TO CALCULATE SALES TAX, ENTER THE SALES AMOUNT.
-----------------------------------------------
TO END PROGRAM, ENTER 0.
TO CALCULATE SALES TAX, ENTER THE SALES AMOUNT.
100.00
CEE3207S The system detected a data exception (System Completion Code=0C7).
From compile unit CALC1000 at entry point CALC1000 at compile unit off
set +000004CE at entry offset +000004CE
at address 2960A126.
Abend 0C7000 hex occurred processing command 'CALL '.
ISPD210 CMD abended - 'CALL' terminated abnormally.
***

my JCL compiler:
000001 //LXW039B JOB 31450,'BATCH COMPILE',MSGLEVEL=(1,1),
000002 // REGION=4M,CLASS=A,MSGCLASS=X,USER=LXW039,
000003 // PASSWORD=
000004 //*
000005 //COMPILE EXEC PROC=IGYWCL,PARM.COBOL='XREF,FLAG(I,E)'
000006 //COBOL.SYSIN DD DSN=MP.LXW039.SOURCE(CALC1000),DISP=SHR
000007 //*
000008 //LKED.SYSLMOD DD DSN=MP.CTEST08.LOAD(CALC1000),DISP=SHR
000009 //*
000010 /*
****** **************************** Bottom of Data ******************

my run command:
tso allocate ddname(sysin) dsname(*)
tso allocate ddname(sysout) dsname(*)
call 'mp.ctest08.load(calc1000)'


could you help me find the cause of this problem run in pc and mainframe, thanks.
lxw039
 
Posts: 47
Joined: Tue Oct 07, 2008 11:49 pm
Has thanked: 0 time
Been thanked: 0 time

Re: what is difference the cobol between mainframe and pc?

Postby dick scherrer » Wed Oct 15, 2008 6:30 am

Hello,

Simply said, your code is incorrect for the mainframe.

I suggest you create a file for your input and process that file rather than trying to use "accept" for your input. Pretty much nowhere permits the use of ACCEPT from the terminal or console ny more.

Also, if you want to include the decimal in the input data, you should look up the NUMVAL function. In addition to results that are not what you want, the 0c7 abend is because of an instruction encountering a non-numeric value in a field defined as numeric.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: what is difference the cobol between mainframe and pc?

Postby lxw039 » Wed Oct 15, 2008 6:16 pm

thanks for your answer, I will try according what you said, but I still want to know if i can use statement ACCEPT
in mainframe and how to use it? thanks again.
lxw039
 
Posts: 47
Joined: Tue Oct 07, 2008 11:49 pm
Has thanked: 0 time
Been thanked: 0 time

Re: what is difference the cobol between mainframe and pc?

Postby dick scherrer » Thu Oct 16, 2008 1:43 am

Hello,

I still want to know if i can use statement ACCEPT
in mainframe and how to use it?

To repeat:
Pretty much nowhere permits the use of ACCEPT from the terminal or console any more.
Every system/organization i have worked with in many years have standards to not allow this.

As you have seen, your code will run with ACCEPT. If you want to continue experimenting, i'd suggest you name a PIC X(nn) field as large as the largest number of characters you will permit as input. After the ACCEPT, you need to write code to validate the content and move the edited value to the appropriate fields to use for your calculation. This will allow the code to produce the expected results as well as prevent the abend.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: what is difference the cobol between mainframe and pc?

Postby lxw039 » Thu Oct 16, 2008 8:24 am

thanks for your patience, I'll try my best !
lxw039
 
Posts: 47
Joined: Tue Oct 07, 2008 11:49 pm
Has thanked: 0 time
Been thanked: 0 time

Re: what is difference the cobol between mainframe and pc?

Postby dick scherrer » Thu Oct 16, 2008 8:51 am

You're welcome - good luck :)

Someone will be here if questions arise,

d
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post