Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

SOC4 after processing 422 records using UNSTRING verb
Goto page 1, 2  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
akshaiya

New User


Joined: 17 Sep 2005
Posts: 49

PostPosted: Sun Feb 25, 2007 7:01 am    Post subject: SOC4 after processing 422 records using UNSTRING verb
Reply with quote

Hi,

Iam using a variable length file of 486 record length.Now iam trying to convert the variable format to fixed record length.
The input file has 7000 records.Input file containing '|' as a seperator for each field.Iam unsing the following code:

Code:
UNSTRING SAJ18-V DELIMITED BY '|'
    INTO variable1
           ,varialbe2
           ,.........................
end-unstring.


Iam getting s0c4 error while reading 422 record.I replicated 421st record to 422nd position considering data problem.But it abends at the same position.Seems some problem with the address.Iam not sure.

Code:
*******************************************
*             Error Location              *
*******************************************
The next sequential instruction to be executed in program ABXAB was at
displacement 00000E76.
                           A B E N D - A I D
The program was compiled on 24 FEB 2007 and is 000014CE bytes long.
It is part of load module ABXAB.
The module was loaded from JOBLIB library ABX.BTCH.OBJLIB.
The module was link edited on 24 FEB 2007 and is 00001920 bytes long.


DD stmt was correct.I tried to increase the space.But it abends at the same position eventhough the cylinders were increased or decreased.

Can anyone help me.
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: Sun Feb 25, 2007 7:39 am    Post subject:
Reply with quote

Hello,

Please post the definition of the data area(s) you are UNSTRINGing into. Please post the actual unstring code rather than typing an example. Also, please post the JCL for this step.

It appears that you know just where you are in the file at the time of the abend, so it will be helpful if you show the lengths of the record before the error, the record after the error and the record where the error occurs.

If you are reading the variable length file, how does "space" become a factor?

From what you've posted, my guess is that there is an over-run between the delimited input and the receiving variables. Please try adding a filler of PIC X(10000) as the last statement in your working-storage.
Back to top
View user's profile Send private message
akshaiya

New User


Joined: 17 Sep 2005
Posts: 49

PostPosted: Sun Feb 25, 2007 10:26 am    Post subject:
Reply with quote

Thanks, Dick.I added a filler of pic x(100) as the last stmt in my output file variable lists.It worked.

Can you please let me know by adding filler ...am I missing some data on any of output variable.Am not sure about overflow.Please make me clear in this.I know the maximum file length of variable length file.Hence I used the maximum length of 486 in the output file section.how can overflow happen?

Thanks Again!
Back to top
View user's profile Send private message
akshaiya

New User


Joined: 17 Sep 2005
Posts: 49

PostPosted: Sun Feb 25, 2007 10:32 am    Post subject:
Reply with quote

There are more than 70 variables in UNSTRING.


Code:
UNSTRING SAJ18-V DELIMITED BY '|'
    INTO variable1
           ,varialbe2
           ,.........................
           ,variable69
           ,variable70
END-UNSTRING.
This is my code.
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: Sun Feb 25, 2007 11:41 am    Post subject:
Reply with quote

You're welcome.

To determine what is going on, put together something (a small program, a sort, or whatever utility you are comfortable with) to copy the records near the first "bad" record to another file - skip the first 419 and copy the next 5. When you have this file, open it in TSO/BROWSE and see what the records looks like. If there are packed or binary numbers, you will want to use HEX ON.

When you have identified the inconsistency and made whatever change is needed, you could use this small file for testing.

As long as the program needs the "protection" of the filler, you won't know what may be missing.

Two thoughts come to mind - a "long" record or one or more extra delimeter characters. You'll be able to tell if it is one of these or something else when you have looked at the small set of records.

I'll be back online later. Good luck and let us know how it goes.
Back to top
View user's profile Send private message
akshaiya

New User


Joined: 17 Sep 2005
Posts: 49

PostPosted: Sun Feb 25, 2007 7:47 pm    Post subject:
Reply with quote

Thanks,Dick.

Can you please let me know whether there is any other method to convert VB to FB other than UNSTRINGing it and writing.As we need to declared all the variables as alphanumeric to use UNSTRING.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Sun Feb 25, 2007 7:58 pm    Post subject:
Reply with quote

Is each field in each record the same size and location as all the equivalent fields in all the other records?
Back to top
View user's profile Send private message
akshaiya

New User


Joined: 17 Sep 2005
Posts: 49

PostPosted: Sun Feb 25, 2007 9:01 pm    Post subject:
Reply with quote

It has the standard(same) layout for every record.It has the total fixed length upto 486.All declared under a group variable.It has different size for each field.some has integer and some has char.Not all the variables are of same size.

Hope I understood your query and replied accordingly.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Sun Feb 25, 2007 9:11 pm    Post subject:
Reply with quote

OK, same layout for every record, but in each record the fields differ from each other, right?
All records are the same length and have the same number of fields, right?
All the fields are separated by one character, a "|", right?
Final output desired is to convert from variable to fixed, right?
Final output desired is for the fields to be in the same order and size that they are in the input record but without the character "|" between each field, right?
Awaiting your reply,

Bill
Back to top
View user's profile Send private message
akshaiya

New User


Joined: 17 Sep 2005
Posts: 49

PostPosted: Sun Feb 25, 2007 11:34 pm    Post subject:
Reply with quote

same layout.it doesnt have record types..First record having 70 variables consiting of variable1 being numeric and variable 2 being char...like that..
All the fields arer seperated by '|'
All records have same length and have same number of fields.
to convert vb to fb
final output desired can have '|' or spaces in that place.

hope I made my query clear.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Sun Feb 25, 2007 11:54 pm    Post subject:
Reply with quote

With COBOL, read the VB file, either examine converting the "|" to a space or through a short perform, squeeze out the "|" (will make record about 69 bytes) then just write FB file out.
This could be done with DFSORT (and Syncsort, I think) also.
Would that output be acceptable?
Back to top
View user's profile Send private message
akshaiya

New User


Joined: 17 Sep 2005
Posts: 49

PostPosted: Mon Feb 26, 2007 12:04 am    Post subject:
Reply with quote

I dont have advanced PTF version.
can you gimee sample code for converting VB to Fb other than using UNSTRING for the following input layout.

01 file-var.
05 WS-ID PIC X(5)
05 WS-PL-NUM PIC S9(7) COMP
05 WS-CST PIC S9(10)V9(3)
05 WS-QTY PIC S9(7)V9(3)
Back to top
View user's profile Send private message
akshaiya

New User


Joined: 17 Sep 2005
Posts: 49

PostPosted: Mon Feb 26, 2007 12:07 am    Post subject:
Reply with quote

for using ,UNSTRING I need to keep all variables as aphanumeric.
But the same 4 variables above will be used in Db2 table to extract data.So if alphanumeric is used in place of ZD,bind plan error occurs.

If possible,provide me a sample code.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Mon Feb 26, 2007 12:18 am    Post subject:
Reply with quote

Now you are confusing me, what happened to the 70 variables? For sort, you don't need the advanced PTF version.
Is this the input or output?
01 file-var.
05 WS-ID PIC X(5)
05 WS-PL-NUM PIC S9(7) COMP
05 WS-CST PIC S9(10)V9(3)
05 WS-QTY PIC S9(7)V9(3)
If the input is not 70 some variables delimited by "|", could you give an example?
If the above is the output, is the comp field already a comp field?
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 Feb 26, 2007 12:51 am    Post subject:
Reply with quote

Hi Akshaiya,

Quote:
Can you please let me know whether there is any other method to convert VB to FB other than UNSTRINGing it and writing.As we need to declared all the variables as alphanumeric to use UNSTRING.


I do not believe you need anyuthing other than UNSTRING.

Before i go into that, did you determine what was "special" about the "bad" record? When last i posted, i thought you were going to identify what was in the first problem record. If you've not done so, please do so now.

Back to UNSTRING. You should UNSTRING the VB data into the fixed fields making sure that each receiving field is AT LEAST big enough to hold the data. ALL of the receiving fields should be PIC X. Once you've completed the unstring, you can move the unstrung fields wherever you need them. It is a good idea to verify that fields that should be numeric (like for loading into a DB2 table) actually are numeric before using them. When you unstring the vb data, the delimiter will "go away" and you do not need to code around it.

There are other ways to re-arrange your data, but they are rather tedious and you have no need to. One of the other ways that was used before unstring was part of COBOL was to define the "string" as an array of 1-character occurrences. Then code was written to parse the "input" one byte at a time and build the "fixed" fields. From what you've posted, UNSTRING should do what you need and you won't get caught up in doing this "manualy".

Let us know what you find out and how it goes. . . icon_smile.gif
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Mon Feb 26, 2007 12:56 am    Post subject:
Reply with quote

Unstringing across that binary field could be dicey.... icon_sad.gif
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 Feb 26, 2007 1:53 am    Post subject:
Reply with quote

Yes, i believe it could. . . .

While the target seems to be moving, we can only offer suggestions on what has been posted. While 70 fields might be tedious, it would surely have helped to know there was embedded binary at the start.

I've still not heard what caused the initial "out of sync" abend. Maybe later . . . It will be much better to know why the filler was needed. It allowed the program to run, but it is questionable if it ran correctly. . .

When i've had to deal with embedded binary data in a "string", i've typically done the UNSTRING on the fields up to the place where the binary starts, dealt with the number of bytes of the binary field, then issued a new unstring beginning after the binary field. If there are multiple binary fields, this needs to be done multiple times,

'Tain't magic, just tedious icon_smile.gif

If the data is coming from a mainframe, i look at converting binary fields to another format when creating the string rather than dealing with it when i try to use it later. This is especially important for data that is to be moved cross-platform (unix/nt).

This
Code:
01 file-var.
05 WS-ID PIC X(5)
05 WS-PL-NUM PIC S9(7) COMP
05 WS-CST PIC S9(10)V9(3)
05 WS-QTY PIC S9(7)V9(3)

isn't variable length. Simple moves would work for these fields. Again, a more complete definition of the real task to be accomplished would help.
Back to top
View user's profile Send private message
akshaiya

New User


Joined: 17 Sep 2005
Posts: 49

PostPosted: Mon Feb 26, 2007 9:27 am    Post subject:
Reply with quote

Dick,I hadnt mentioned in my previous post that I didnt find anything wrong in that record.Its normal like the other record.
i.e it abends while processing/writing 422nd record.It means that it has processed till 421 records.I swapped the records 422 and 421.It again abends while processing 422md record(which is having swapped 421st record - processed before and failed now).
I checked well,but not sure why was it so?

The reason for asking process other than UNSTRING is that I need to declare all the variables as alphanumeric.By doing so,I need to convert alphanumeric to numeric(in case of numberic variable).

I did it by redefine clause.
for eg.

var1 x(7)
var2 9(7) - (this value is required)

var1 contains value '985'

when i moved to numeric,it shows 985000.After using redefine clause


var1 pic x(7)
var2 redefines var1 pic 9(7)

The result after displaying var1 and var2 are:
var 1 = 985
var2 = 985 0

value 0 comes as the last byte.0 is removed in between.Not sure why it got at the end.can anyone tell me how to move without the above problem?

Hope I made my query clear.
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 Feb 26, 2007 9:56 am    Post subject:
Reply with quote

Hi Akshaiya,

Getting the data out of the variable format to unstrung fixed PIC X fields is only part of the work to be done. Now that you have broken the group into individual items, you need to work from item 1 to item n ensuring the rules for that item are followed. Most of the PIC X fields may be straight moves. The numeric fields will have to be dealt with in more detail.

I'd suggest that you create a few common routines (depending on how many kinds of numeric fields you need to support), move a PIC X that will be moved into a numeric field to a work field, then check the content to conformance to that field's rule and building the needed PIC 9 field.

This situation
Code:
var1 pic x(7)
var2 redefines var1 pic 9(7)

The result after displaying var1 and var2 are:
var 1 = 985
var2 = 985 0
is fairly common. As i said earlier in this reply, you will need to deal with each of these numeric fields. In this case your routine would find how long the numbers are (3) and move only the 3 numerals to the PIC 9(7) field.

Something much like this was discussed recently in another thread and from that exchange i'd suggest you might look into the
Quote:
COMPUTE PIC-9 = FUNCTION NUMVAL (PIC-X)
intrinsic function. Depending on your data requirements/rules, this may be able to help you.

Back to the abend - is there by chance an index or subscript that is being used and not reset at the start of each record read? If you copy the file and discard records 400 thru 450 (just for a test) does the abend still occur? If it does it may be that "something" is gradually "walking on" the storage in your program - most likely cause is an array gone out of control.
Back to top
View user's profile Send private message
akshaiya

New User


Joined: 17 Sep 2005
Posts: 49

PostPosted: Mon Feb 26, 2007 1:50 pm    Post subject:
Reply with quote

Thanks Dick.

COMPUTE PIC-9 = FUNCTION NUMVAL (PIC-X) .
The above 2 variables are declared accordingly.

Code:
"FUNCTION" was specified as an informational word in the current reserved word t
used may be different from the IBM-supplied default.  Refer to VS COBOL II Appli
Reference for information on reserved words.

"FUNCTION" was not defined as a data-name.  The statement was discarded.

"NUMVAL" was invalid.  Skipped to the next verb, period or procedure-name defini


Should I need to declare something to use this FUNCTION,NUMVAL
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
Goto page 1, 2  Next
Page 1 of 2

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts abend sort based on count records in ... anatol DFSORT/ICETOOL 5 Mon Oct 17, 2016 10:10 pm
No new posts Run stats processing on zIIP Engine Virendra Shambharkar DB2 9 Fri Oct 14, 2016 10:24 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us