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

LINK system macro


IBM Mainframe Forums -> PL/I & Assembler
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Thanatopsis

New User


Joined: 02 Dec 2010
Posts: 7
Location: Houston

PostPosted: Fri Feb 04, 2011 7:23 am
Reply with quote

Hi forum,

I'm hoping someone could help me get some insight. I'm using the system macro LINK to call DFSORT from an ASM routine, and I am so close to having it working.

I want to supply an input routine and an output routine (each of which I have written and debugged already).

What i do is, point R1 at the parameter list (of course) and code this:
Code:

          LINK EP=SORT
          LTR  R15,R15
          BNZ  RTNERR


I'm getting the info messages from DFSORT printed in the SYSOUT DD, and they confirm that the settings I'm passing to it are being read correctly. Also, I set up a "dummy" input and output routine just to print the records as they get them, and the records are getting put into the sort, and the output routine is fetching them all. It seems to be going well, right?

But then somewhere between the final output exit call (when I have it return 8, signaling the sort to exit) and when I should be getting control back its throwing a S0C6.

I wondered if anyone has done this sort of thing before and might have a suggestion where to look for the problem. Its bewildering my what I could be telling sort to do that makes it come up with a S0C6. I thought those only happen when something didn't align where it needed to.
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Fri Feb 04, 2011 1:22 pm
Reply with quote

Did you do the saving/restoring, setup base register(s) like you would do
at the start/end of your program?
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Fri Feb 04, 2011 1:43 pm
Reply with quote

Here is an example for your sortin processing, the same should be done for your sortout processing :


Code:

SORTIN   EQU    *                                                       04610000
         STM    R14,R12,12(R13)        SAVE SOME REGISTERS              04620000
         LR     R9,R15                 LOAD ENTRY POINT                 04630000
         USING  SORTIN,R9              SET UP ADDRESSABILITY            04640000
         LR     R14,R13                                                 04650000
         LA     R13,SAVEIN                                              04660000
         ST     R14,4(R13)                                              04670000
         ST     R13,8(R14)                                              04680000
         B      SORTIN1                                                 04690000
SAVEIN   DC     18F'0'                                                  04700000
SORTIN1  EQU    *
other processing code
EOFE15   LA     R15,8                  SET UP END OF DATA INDICATOR     04950000
         B      SORTINX                                                 04960000
SORTIN12 LA     R15,12                 SET UP INSERT RECORD INDICATOR   04970000
SORTINX  L      R13,SAVEIN+4           RESTORE                          04980000
         L      R14,12(R13)                   SOME                      04990000
         LM     R2,R12,28(R13)                    REGISTERS             05000000
         BR     R14                    RETURN TO SORT                   05010000
Back to top
View user's profile Send private message
Thanatopsis

New User


Joined: 02 Dec 2010
Posts: 7
Location: Houston

PostPosted: Fri Feb 04, 2011 7:37 pm
Reply with quote

Thanks for the input. Yep, I'm using standard entry/exit linkage for input and output routines. Each of them are getting called many times and exiting fine, it is only after I issue the return code 8 from my output exit that SORT gets a S0C6.

Small update: I didn't realize the address constants for my exits had to have the high order bits on to indicate the exits should be entered in AMODE31, so I added some OI instructions to turn those on. Now its the same situation, but with a S0C1 instead.

I'm chipping away at it, but any help is appreciated. Thanks again.
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Fri Feb 04, 2011 8:00 pm
Reply with quote

0C6, 0C1 abends can mean the following :

Invalid or missing DD statement.
Reading or writing an unopened file.

Do you close your input/output correctly after finishing your sort input/output routines? And if yes not doing any IO again against the datasets?

I used the default AMODE (that is AMODE24) and never had a problem
with linking sort.
Back to top
View user's profile Send private message
Thanatopsis

New User


Joined: 02 Dec 2010
Posts: 7
Location: Houston

PostPosted: Sat Feb 05, 2011 10:16 pm
Reply with quote

Problem solved. After your suggestion, I carefully looked at all the in's and out's of the input file I'm dealing with, and I found I was calling the read routine incorrectly. It turns out the read routine is designed to be called in a different way from cobol than from assembler, (with a flag byte to indicate the type of caller) and I based my parameter list on a COBOL example I had access to. (silly me). Something probably lined up wrong, since I'm using the assembler macro to generate the record DSECT.

Aren't the gnarliest of problems always caused by something equally as simple?

Anyway, long story short: It works now. Thanks everyone for the suggestions.
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Sat Feb 05, 2011 11:43 pm
Reply with quote

Quote:

Thanks everyone for the suggestions.


Well it was only me. But whatever you are welcome.
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 -> PL/I & Assembler

 


Similar Topics
Topic Forum Replies
No new posts Sysplex System won't IPL at DR site I... All Other Mainframe Topics 2
No new posts How to delete a user's alias from the... JCL & VSAM 11
No new posts PRINTOUT macro PL/I & Assembler 0
No new posts Insert system time/date (timestamp) u... DFSORT/ICETOOL 5
No new posts JCL Dynamic System Symbols JCL & VSAM 3
Search our Forums:

Back to Top