Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
SOC7 abend while running UNSTRING statement...

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
karthikr44

Active User


Joined: 25 Aug 2007
Posts: 235
Location: Chennai

PostPosted: Mon Jun 30, 2008 8:21 pm    Post subject: SOC7 abend while running UNSTRING statement...
Reply with quote

Code:

WORKING-STORAGE SECTION.                                           
                                                                   
01  WK-DETAIL.                                                     
                                                                   
    05 WK-ADDR-1               PIC X(16) VALUE '123 LD'.           
    05 WK-ADDR-2               PIC X(16) VALUE 'MECELLON CIRCLE'.   
    05 WK-CITY                 PIC X(16) VALUE 'LOS ANGELS'.       
    05 WK-CODE                 PIC X(16) VALUE 'LA'.               
                                                                   
01 WK-DTL-RECORD.                                                   
   05 WK-DTL-REC              OCCURS 20 TIMES                       
                              INDEXED BY WK-SUB2.                   
      10 WK-DTL               PIC  X(08).                           
                                                                   
05 WK-SW-EOF              PIC X(1)   VALUE 'N'.                     
   88 WK-UNTL-EOF                    VALUE 'Y'.                     
   88 WK-UNTL-NOT-EOF                VALUE 'N'.                     
                                                                   
01  WK-CNT.                                                         
     05 WK-C1                   PIC 9(2).                               
     05 WK-NBR-1                PIC S9(1) VALUE +1.                     
     05 WK-C2                   PIC 9(2).                               
                                                                       
 01 WK-POINTER-P.                                                       
    05 WK-POINTER               PIC S9(3).                             
                                                                       
 01  WK-STRING.                                                         
     05 WK-STR                  PIC X(10).                             
                                                                       
******************************************************************     
*                      PROCEDURE DIVISION                        *     
******************************************************************     
                                                                       
 PROCEDURE DIVISION.                                                   
                                                                       
     PERFORM 1-INITIALIZATION                                           
                                                                       
     GOBACK                                                             
      .                                                                 
      EJECT                                                             
                                                                         
  1-INITIALIZATION.                                                     
 ******************************************************************     
 * 1-INITIALIZATION                                               *           
 ******************************************************************     
                                                                         
      SET WK-SUB2                    TO WK-NBR-1                         
                                                                         
      PERFORM UNTIL WK-UNTL-EOF                                         
            UNSTRING WK-DETAIL DELIMITED BY ALL SPACES                   
                       INTO WK-DTL-REC(WK-SUB2)                         
                       WITH POINTER WK-POINTER     
                 ON OVERFLOW  SET WK-UNTL-EOF TO TRUE   
          END-UNSTRING                                   
    SET WK-SUB2                 UP BY WK-NBR-1           
          DISPLAY 'WK-DTL:' WK-DTL(WK-SUB2)             
    END-PERFORM                                         

   .             
   EJECT                       



While running this program i get SOC7 abend in UNSTRING statement.
I dont know the cause of error.


Anybody help...

Thanks
R KARTHIK
Back to top
View user's profile Send private message

Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8201
Location: Dubuque, Iowa, USA

PostPosted: Mon Jun 30, 2008 8:32 pm    Post subject:
Reply with quote

From the Language Reference manual:
Quote:
6.2.39.5 POINTER phrase


When the POINTER phrase is specified, the value of the pointer field, identifier-7, behaves as if it were increased by 1 for each examined character position in the sending field. When execution of the UNSTRING statement is completed, the pointer field contains a value equal to its initial value plus the number of character positions examined in the sending field.

When this phrase is specified, the user must initialize the pointer field before execution of the UNSTRING statement begins.


WK-POINTER is not being initialized.
Back to top
View user's profile Send private message
karthikr44

Active User


Joined: 25 Aug 2007
Posts: 235
Location: Chennai

PostPosted: Mon Jun 30, 2008 8:44 pm    Post subject: Reply to: SOC7 abend while running UNSTRING statement...
Reply with quote

Hi Robert,

U are correct. After initializing the pointer variable to 1, the abend is removed. But the o/p still doexnt come correctly.

I/p record
Code:

WK-DETAIL:123 LD          MECELLON CIRCLE LOS ANGELS      LA                 


O/P i got
Code:

WK-DTL:


Perform loop is occuring only once and WK-DTL(1) has value as spaces.

Regards
R KARTHIK
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8201
Location: Dubuque, Iowa, USA

PostPosted: Mon Jun 30, 2008 9:32 pm    Post subject:
Reply with quote

I think you're expecting more from UNSTRING than you get. To quote from the manual:
Quote:
6.2.39.7 ON OVERFLOW phrases


An overflow condition exists when:

* The pointer value (explicit or implicit) is less than 1.

* The pointer value (explicit or implicit) exceeds a value equal to the length of the sending field.

* All data receiving fields have been acted upon and the sending field still contains unexamined character positions.

You have exactly one data receiving field -- WK-DTL-REC(WK-SUB2) so after the first field delimited by space is moved, the overflow condition applies since there's still unexamined data in the sending field. You can either do multiple receiving fields
Code:
INTO FIELD-1 FIELD-2 FIELD-3
or you can restructure your logic to handle the one received field at a time.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Mon Jun 30, 2008 11:17 pm    Post subject:
Reply with quote

Hello,

If you post how you want your process to work, someone may have a suggestion.

Show some more input and the output you want from that input. The "output" can be fields in working storage. . .
Back to top
View user's profile Send private message
karthikr44

Active User


Joined: 25 Aug 2007
Posts: 235
Location: Chennai

PostPosted: Tue Jul 01, 2008 11:00 am    Post subject: Reply to: SOC7 abend while running UNSTRING statement...
Reply with quote

Hi dick scherrer,

U are correct...

My input:

WK-DETAIL:123 LD MECELLON CIRCLE LOS ANGELS LA

Desired o/p:

WK-DTL(1):123
WK-DTL(2):LD
WK-DTL(3):MECELLON
WK-DTL(4):CIRCLE
WK-DTL(5):LOS
WK-DTL(6):ANGELS
WK-DTL(7):LA

For achieving this i tried
SET WK-SUB2 TO WK-NBR-1

PERFORM UNTIL WK-UNTL-EOF
UNSTRING WK-DETAIL DELIMITED BY ALL SPACES
INTO WK-DTL-REC(WK-SUB2)
WITH POINTER WK-POINTER
ON OVERFLOW SET WK-UNTL-EOF TO TRUE
END-UNSTRING
SET WK-SUB2 UP BY WK-NBR-1
DISPLAY 'WK-DTL:' WK-DTL(WK-SUB2)
END-PERFORM

But i got o/p,
WK-DTL(1): spaces

Perform loop is occuring only once.

Hi robert still i dont know how many fields it is not possible to code

INTO FIELD-1 FIELD-2 FIELD-3

Is there any other way?

Regards
R KARTHIK
Back to top
View user's profile Send private message
karthikr44

Active User


Joined: 25 Aug 2007
Posts: 235
Location: Chennai

PostPosted: Tue Jul 01, 2008 4:55 pm    Post subject: Reply to: SOC7 abend while running UNSTRING statement...
Reply with quote

Hi,

Does anybody know how to acchieve this?

Regards
R KARTHIK
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8201
Location: Dubuque, Iowa, USA

PostPosted: Tue Jul 01, 2008 5:57 pm    Post subject:
Reply with quote

Your best bet would be
Code:
           MOVE SPACES                 TO  WK-DTL-RECORD.

           UNSTRING WK-DETAIL
               DELIMITED BY ALL SPACES
               INTO WK-DTL-REC (01)
                    WK-DTL-REC (02)
                    WK-DTL-REC (03)
                    WK-DTL-REC (04)
                    WK-DTL-REC (05)
                    WK-DTL-REC (06)
                    WK-DTL-REC (07)
                    WK-DTL-REC (08)
                    WK-DTL-REC (09)
                    WK-DTL-REC (10)
           END-UNSTRING .

           PERFORM VARYING WK-C1 FROM 1 BY 1
                     UNTIL WK-DTL-REC (WK-C1) = SPACES
               DISPLAY WK-DTL-REC (WK-C1)
           END-PERFORM .
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Tue Jul 01, 2008 9:02 pm    Post subject:
Reply with quote

Hello,

Quote:
While running this program i get SOC7 abend in UNSTRING statement.
Is this still a problem?

Please convert your perform/unstring code to the example Robert posted and post back here if there are questions or problems.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Job is running with no response!!! Vignesh Sid DB2 3 Fri Oct 27, 2017 6:28 pm
No new posts COBOL - EXIT statement weird behavior anthony.pangestu COBOL Programming 0 Fri Oct 27, 2017 9:57 am
No new posts ASP3 ABEND IN CICS Vedant CICS 0 Fri Oct 20, 2017 3:18 pm
No new posts WER268A OUTREC STATEMENT : SYNTAX E... frozenblood87 SYNCSORT 12 Sat Aug 26, 2017 9:45 pm
No new posts Suppress value reported by BREAK in D... Learncoholic DFSORT/ICETOOL 3 Wed Aug 16, 2017 6:03 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us