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

How to define Undefined records in Assembelr


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

New User


Joined: 05 Nov 2008
Posts: 21
Location: chennai

PostPosted: Thu Nov 06, 2008 12:53 pm
Reply with quote

Hi guys

I want read af file whose RECFM=U.

Can some one tell how can we define it in assembler
what are its DCB parameters.

its a huge file with Blksize=32004

please do help .

Thanks in advance
-sai
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Thu Nov 06, 2008 8:17 pm
Reply with quote

Code:
TESTDCB  DCB   DDNAME=SYSTEST,BLKSIZE=32004,DSORG=PS,RECFM=U,MACRF=(GM)
assembles without any messages for me.
Back to top
View user's profile Send private message
Bill Dennis

Active Member


Joined: 17 Aug 2007
Posts: 562
Location: Iowa, USA

PostPosted: Thu Nov 06, 2008 8:34 pm
Reply with quote

As you have stated, the DCB parms are RECFM=U,BLKSIZE=32004.

When you read a record, there will be a value in the DCB area for the actual length read on this record. Your pgm must be smart enough to know how to distinguish record types and what to do with them.

I would recommend checking the GET macro in the DFSMS manual "Macro Instructions for Datasets" for tips on how to do this.
Back to top
View user's profile Send private message
sakrish

New User


Joined: 05 Nov 2008
Posts: 21
Location: chennai

PostPosted: Fri Nov 07, 2008 7:35 am
Reply with quote

Thanks guys,

My doubt is when defining a record for that file

TESTRECD DS 0CL32004
will work or not.

Can Assembler handle this much length of records ?


-Sai
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Fri Nov 07, 2008 7:55 am
Reply with quote

Hello,

From a fairly recent Assembler reference manual:
Quote:
Unlike the DC instruction, the DS instruction causes no data to be assembled. Therefore, you do not have to specify the nominal value (fourth subfield) of a DS instruction operand. The DS instruction is the best way of symbolically defining storage for work areas, input/output buffers, etc.

Although the formats are identical, there are two differences in the specification of subfields. They are:

The nominal value subfield is optional in a DS operand, but it is mandatory in a DC operand. If a nominal value is specified in a DS operand, it must be valid.

The maximum length that can be specified for the character (C) and hexadecimal (X) type areas is 65,535 bytes rather than 256 bytes for the same DC operands. The maximum length for the graphic (G) type is 65,534 bytes.
Back to top
View user's profile Send private message
sakrish

New User


Joined: 05 Nov 2008
Posts: 21
Location: chennai

PostPosted: Fri Nov 07, 2008 11:10 am
Reply with quote

Thanks again, my code is active now

But in my JCL, i am getting SOC 04 error

MY program has input file name as INFILE and output file name as OUTFILE

and JCL DD names are INFILE1 and OUTFILE1


Code:
*******************************************                             
*            Analysis of Error            *                             
*******************************************                             
                                                                         
The system completion code of 0C4 is issued when the program attempts to
use storage that is not accessible.                                     
                                                                         
                                                                         
*** List of Probable 0C4 Causes ***                                     
                                                                         
1.  Missing or incorrect DD statement -                                 
    Check system messages from abending step.                           
                                                                         
2.  Tried to read or write an unopened file.                             
                                                                         
3.  Tried to reference record area before file opened.                   
                                                                         
4.  Indexing or subscripting outside defined limits.                     


I think may be 4th one is causing me to get SOC4


Can some one guide me what may be wrong ?

Thanks in advance
-Sai
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Fri Nov 07, 2008 11:56 am
Reply with quote

Hello,

Quote:
Can some one guide me what may be wrong ?
Not from what you have posted. . .

For us to be able to help, we need something to work with.

How much assembler have you written before this program? How large is this program? Suggest you put bits of diagnostic code in your program to determine where it abends. Once you know where it abends, it should be easier to fix it.
Back to top
View user's profile Send private message
sakrish

New User


Joined: 05 Nov 2008
Posts: 21
Location: chennai

PostPosted: Sat Nov 08, 2008 8:08 am
Reply with quote

Hi,

Out of list of 4 causes,

1. I checked DD statements..everything looks good

2. I have fixed this in program setting abend codes..

3. I am following standards of code..as my code comes in sequence

4. Only the thing , i guess

I am only copying my input file to output file. her is the code
Code:
 CA010    DS    0F             
         GET   PULLFILE,PULLREC
         MVC   OUTREC,PULLREC 
         PUT   OUTFILE,OUTREC 
         B     CA010           



Code:
 My file declarationsPULLFILE DCB   MACRF=(GM),                   
               DDNAME=PULLFILE,BLKSIZE=32004,
               DSORG=PS,RECFM=U,             
               EODAD=CA090,                 
*                                           
OUTFILE  DCB   MACRF=(PM),                   
               DDNAME=TESTFILE,BLKSIZE=32004,
               RECFM=U,DSORG=PS       


Please let me know if any information still I have to give.

-Sai
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Sat Nov 08, 2008 8:17 am
Reply with quote

Hello,

How is pullrec defined? How is outrec defined?

You've used mvc which will not move 32k bytes - it will move 256 max. . . Look at the mvcl (move long) instruction.

It is almost certain that you've "walked on storage".

As i asked before, how much assembler experience do you have? This may not be the time to begin learning assembler just because of this file - it sounds like you want/need to move forward more quickly.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Sat Nov 08, 2008 8:23 am
Reply with quote

Quote:
*** List of Probable 0C4 Causes ***
This is by no means an exhaustive list -- there are other things that can cause a S0C4. Don't just run through these 4 and think you've looked at all possible reasons.

Also, what does your execution JCL look like?
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Sat Nov 08, 2008 8:30 am
Reply with quote

Quote:
and JCL DD names are INFILE1 and OUTFILE1

Quote:
DDNAME=PULLFILE

Quote:
DDNAME=TESTFILE


Are we talking about the same program all along or did something suddenly get changed?
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Sat Nov 08, 2008 1:02 pm
Reply with quote

I want to is not enough to make code work...
how the code works depends on how You have worked

looking at the code snippets You posted .......
You did not care to read the manual about undefined record processing
publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/DGT2D540/2.2.28?SHELF=DGT2BK71&DT=20070427024428
and
publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/DGT2D540/2.2.43?SHELF=DGT2BK71&DT=20070427024428

undefined record..... aaarghhhhh!?!?!?
once in a while I will not make any recommendations on proper application design
if Your organization wants to shoot itself in the foot, I will be glad to hand You a loaded gun icon_biggrin.gif
Back to top
View user's profile Send private message
Pedro

Global Moderator


Joined: 01 Sep 2006
Posts: 2546
Location: Silicon Valley

PostPosted: Sat Nov 08, 2008 9:44 pm
Reply with quote

Quote:
1. I checked DD statements..everything looks good

As Robert pointed out, your DD names are not ok. The JCL ddnames have to match the same ones as used in the DCBNAME=parameter of the DCB statements.

What are the return codes from your OPEN statements?


Quote:
I am only copying my input file to output file

A minor point... You do not need to move the data... just do your PUT from the same buffer.
Code:
 CA010    DS    0F             
         GET   PULLFILE,PULLREC
         PUT   OUTFILE,PULLREC
         B     CA010 
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Sat Nov 08, 2008 11:47 pm
Reply with quote

the TS did not post anything useful for a good problem determination...

he started by defining the buffer with .... DS 0CL....
continuing with an mvc,
keeping on without retrieving the block lenght from the input DCB,
and again without storing it in the output DCB...
and... confusing/misquoting the ddnames...

I wonder how he can affirm that his code is active

I might be picky, but that' s too much

....why a 32004 blksize,
whenever there is the need to treat Undefined records the best blksize to use is 32760,
or better use the DEVTYPE macro to get the largest blksize supported by the device
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Sun Nov 09, 2008 12:01 am
Reply with quote

I suspect the S0C4 is due to the DS 0CL32004 definition -- who knows what storage is getting wiped out in the read? But that's probably irrelevant since it's not at all clear if we're talking about one program, two programs, or even code that makes sense!
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Sun Nov 09, 2008 12:46 am
Reply with quote

Hello,

This code is the result of frustration with "the file". After other approaches did not work, assembler is being attempted (while it is being learned).

I suspect we can be more productive if we learn where the file came from and what it contains. Once we know what we're dealing with (rather than the assembler code to read the file) we may be better able to offer suggestions. Once the file is read in assembler, the content may not be usable. . .

Several times i've seen something like this, a file was ftp'ed to the mainframe and it was in some priprietary format (spreadsheet, word, etc) and simply recreating the file to upload solved all of the problems.
Back to top
View user's profile Send private message
sakrish

New User


Joined: 05 Nov 2008
Posts: 21
Location: chennai

PostPosted: Tue Nov 11, 2008 12:50 pm
Reply with quote

Thanks guys..

My inputfile is created by a assembler program

But I couldnt understand what that program is ? its very complicated and huge program.. I had written only few simple assembler codes still now.

We get the file from upstream application.

the ifle will have 01 record and 99 record commom to all records

Between i have 10 th record to 90th record..we call whole thing as bundle.

We may have 1 or more bundles in a file.

What my requirement is we need to extract each bundle..for which 01 and 99 are common

I have written a report in easytrieve which will show each bundle starts at what line and ends at what line.


can we use DFSORT to extract those records..?
I know we couldnt use DFSORT for RECFM=U files.

Can we convert undefined to FB records and process the records..

My mistake..is My names what i mentioned were wrong..ie just for ur understanding..i typed INFILE and OUTFILE..actually i am using PULLFILE and OUTFILE..thats not a problem

A very speacial thanks to all..
I am sorry if I wasted any ones time by my post.

-Sai
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Tue Nov 11, 2008 1:17 pm
Reply with quote

Hello,

Quote:
I have written a report in easytrieve which will show each bundle starts at what line and ends at what line.
Is this code using the recfm=u file as input? If the file is undefined, how does the code know what lines are in a bundle?
Back to top
View user's profile Send private message
sakrish

New User


Joined: 05 Nov 2008
Posts: 21
Location: chennai

PostPosted: Tue Nov 11, 2008 1:36 pm
Reply with quote

I just kept a count of records in the file ..If I encounter 10 th record..i will display count number..and 90th record will display end of bundle count..
so I can know where my bundle starts and where it ends..
Back to top
View user's profile Send private message
sakrish

New User


Joined: 05 Nov 2008
Posts: 21
Location: chennai

PostPosted: Wed Nov 19, 2008 3:14 pm
Reply with quote

Hi guys,

I did it with Easytrieve of extracting the records from Undefined file

but my input file has
Code:

+----8----+----9----+----0----+----1----
+----F----+----F----+----F----+----F----
+----8----+----9----+----0----+----1----
----------------------------------------
************************** Top of Data *
                                       
                                       
----------------------------------------
  H                                     
44C4444444                             
0080000000                             
----------------------------------------
672521                                 
FFFFFF4444                             
6725210000                             
----------------------------------------


doesnt have any values after 85th column


and my extracted file has

Code:

+----8----+----9----+----0----+----1----+
+----F----+----F----+----F----+----F----+
+----8----+----9----+----0----+----1----+
-----------------------------------------
**************************** Top of Data
                                         
                                         
-----------------------------------------
672521                                   
FFFFFF44444444444444444444444444444444444
67252100000000000000000000000000000000000
-----------------------------------------
1214041172                               
FFFFFFFFFF4444444444444444444444444444444
12140411720000000000000000000000000000000
-----------------------------------------

has value X'40' after 85 th column.

Can some one please help..Is any way to make it blank.

Thanks
Sai
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Wed Nov 19, 2008 9:16 pm
Reply with quote

Hello Sai,

X'40' is a blank.

Your extracted file appears to be fixed length and when you wrote the records, they were filled with spaces. How is your output file defined to Easytrieve?
Back to top
View user's profile Send private message
sakrish

New User


Joined: 05 Nov 2008
Posts: 21
Location: chennai

PostPosted: Thu Nov 20, 2008 9:53 am
Reply with quote

Hi,

I have defined my output file as my block size is 32004
Code:
FILE INFILE3 U 32004


and in JCL, i defined it as
Code:
//INFILE3  DD  DSN=XCIT.ACH.TEST.OUTPUT1,
//        DISP=(NEW,CATLG,DELETE),       
//        SPACE=(CYL,(150,1500),RLSE),   
//        DCB=(DSORG=PS,RECFM=U)       


let me know if you need still any infromation.

Thanks,
sai
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Thu Nov 20, 2008 10:17 am
Reply with quote

Hello,

How did you set up the move/write to the output file?
Back to top
View user's profile Send private message
sakrish

New User


Joined: 05 Nov 2008
Posts: 21
Location: chennai

PostPosted: Thu Nov 20, 2008 1:09 pm
Reply with quote

hi

my input file
Code:
FILE INFILE1
INFILE1-F-RECD 01 32004 A


I am moving
Code:
move infile1-f-recd to INFILE3


so..it is givng x'40'.

but how to define INFILE1-F-RECD other than alphanumeric

-sai[/quote]
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Thu Nov 20, 2008 9:52 pm
Reply with quote

Hello,

Quote:
but how to define INFILE1-F-RECD other than alphanumeric
As far as i know, files/records are always alphanumeric.

Once you extract these "bundles" how will they be used? Is there new code being written to use the data you are creating?
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 Goto page 1, 2  Next

 


Similar Topics
Topic Forum Replies
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts DTL - how to define key with stacked ... TSO/ISPF 3
No new posts Join multiple records using splice DFSORT/ICETOOL 5
No new posts EZT program to build a flat file with... All Other Mainframe Topics 9
Search our Forums:

Back to Top