View previous topic :: View next topic
|
Author |
Message |
kiran
New User
Joined: 08 Apr 2004 Posts: 25 Location: hyd
|
|
|
|
Hi,
suppose i've two programs like prog A is calling program and prog B is called program.
i've written CALL PROGRAM-ID USING PARM1,PRAM2
and i've also specified in called program as:
PROCEDURE DIVISION USING AA,BB
my doubt is , if initially im not sending any values from calling program to called program i.e. when calling program called the sub program intially.
that means it gives any error? if not ,what values will be passed to called program initially. |
|
Back to top |
|
|
mdtendulkar
Active User
Joined: 29 Jul 2003 Posts: 237 Location: USA
|
|
|
|
Hello kiran,
Quote: |
if initially im not sending any values from calling program to called program
|
With this there are 2 options...
1) You have removed USING phrase
2) You are not passing ANYTHING in the variables.
In case of second option, if you are initializing the linkage section variables before using the calling program values, there will not be a problem as per the normal initialization rules.
Best way is to try out a simple calling & called program.
Calling Program
Code: |
IDENTIFICATION DIVISION.
PROGRAM-ID. MAIN-PRG.
DATE-COMPILED.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 PASSED-DATA PIC X(05).
PROCEDURE DIVISION.
CALL "SUB-PRG" USING PASSED-DATA.
MOVE SPACES TO PASSED-DATA.
CALL "SUB-PRG" USING PASSED-DATA.
MOVE 'KIRAN' TO PASSED-DATA.
CALL "SUB-PRG" USING PASSED-DATA.
GOBACK.
|
Called Program
Code: |
IDENTIFICATION DIVISION.
PROGRAM-ID. SUB-PRG.
DATE-COMPILED.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 WS-DATA PIC X(05) VALUE SPACES.
LINKAGE-SECTION.
01 RECEIVED-DATA PIC X(05).
PROCEDURE DIVISION USING RECEIVED-DATA.
DISPLAY RECEIVED-DATA
INITIALIZE WS-DATA
MOVE RECEIVED-DATA TO WS-DATA
DISPLAY WS-DATA
GOBACK.
|
I have not tried this code..so let us know the results.
Hope this helps,
Regards
Mayuresh Tendulkar |
|
Back to top |
|
|
sandip_datta
Active User
Joined: 02 Dec 2003 Posts: 150 Location: Tokyo, Japan
|
|
|
|
I think it will thrrow any error unless you want this. Initially the value passed from Program A to Program B depeneds on the structures of PARM1 and PARM2. Example if those are numeric the value passed will be 0 and if those are alphanumeric then SPACE.
Expert, please correct me if I am wrong.
Regards,
Sandip. |
|
Back to top |
|
|
sandip_datta
Active User
Joined: 02 Dec 2003 Posts: 150 Location: Tokyo, Japan
|
|
|
|
I am sorry about the first sentence. It should not throw any error messages. |
|
Back to top |
|
|
mdtendulkar
Active User
Joined: 29 Jul 2003 Posts: 237 Location: USA
|
|
|
|
Hello sandip,
Thats why i specified
Quote: |
In case of second option, if you are initializing the linkage section variables before using the calling program values, there will not be a problem as per the normal initialization rules.
|
INITIALIZE verb will initialize the numeric items to ZERO to alphanumeric items to SPACES.
Hope this helps,
Regards
Mayuresh Tendulkar |
|
Back to top |
|
|
kiran
New User
Joined: 08 Apr 2004 Posts: 25 Location: hyd
|
|
|
|
mdtendulkar wrote: |
Hello kiran,
Quote: |
if initially im not sending any values from calling program to called program
|
With this there are 2 options...
1) You have removed USING phrase
2) You are not passing ANYTHING in the variables.
In case of second option, if you are initializing the linkage section variables before using the calling program values, there will not be a problem as per the normal initialization rules.
Best way is to try out a simple calling & called program.
Calling Program
Code: |
IDENTIFICATION DIVISION.
PROGRAM-ID. MAIN-PRG.
DATE-COMPILED.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 PASSED-DATA PIC X(05).
PROCEDURE DIVISION.
CALL "SUB-PRG" USING PASSED-DATA.
MOVE SPACES TO PASSED-DATA.
CALL "SUB-PRG" USING PASSED-DATA.
MOVE 'KIRAN' TO PASSED-DATA.
CALL "SUB-PRG" USING PASSED-DATA.
GOBACK.
|
Called Program
Code: |
IDENTIFICATION DIVISION.
PROGRAM-ID. SUB-PRG.
DATE-COMPILED.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 WS-DATA PIC X(05) VALUE SPACES.
LINKAGE-SECTION.
01 RECEIVED-DATA PIC X(05).
PROCEDURE DIVISION USING RECEIVED-DATA.
DISPLAY RECEIVED-DATA
INITIALIZE WS-DATA
MOVE RECEIVED-DATA TO WS-DATA
DISPLAY WS-DATA
GOBACK.
|
I have not tried this code..so let us know the results.
Hope this helps,
Regards
Mayuresh Tendulkar |
Hi,
thanx for the reply. And I've one more doubt i.e. if suppose the sub program function is reading some file and passing the record of the file to the calling program.
in the sub program i've mentioned as
SELECT FILENAME ASSIGN TO DD1
ORGANIZATION .....
ACCESSMODE ....... .
then how to specify this DD1 in compile jcl and run jcl.
pls give me the example jcl's for both comiple and run jcls. |
|
Back to top |
|
|
sandip_datta
Active User
Joined: 02 Dec 2003 Posts: 150 Location: Tokyo, Japan
|
|
|
|
Hello Mayuresh,
It seems that we both have submitted the replies almost at at time. Beleive me...I didn't see that you have already replied.
hello kiran,
the ddname dd01 will not have anything special. you can just code -
//dd01 dd dsn=..........,disp=shr
Regards,
Sandip. |
|
Back to top |
|
|
sudha
New User
Joined: 16 Aug 2004 Posts: 7
|
|
|
|
hi,
i think it will not give error. if you are passing numeric item then 0's will move to identifiers and if u r passing alphanumeric or alphabetic then spaces will be moved.
if my answer is wrong please suggest
thank you
bye |
|
Back to top |
|
|
sudha
New User
Joined: 16 Aug 2004 Posts: 7
|
|
|
|
hi,
i think it will not give error. if you are passing numeric item then 0's will move to identifiers and if u r passing alphanumeric or alphabetic then spaces will be moved.
if my answer is wrong please suggest
thank you
bye |
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
Sudha,
The best thing to do is add a 3rd param to indicate the type of CALL, e.g. initial (I), repetative (R), or final (F).
The CALLing pgm enters I R or F depending on circumstannces. The CALLed pgm should contain code to test the 3rd param and act accordingly.
Regards, Jack. |
|
Back to top |
|
|
|