Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Wanted MVS Assembler program to read any flat file

Wanted MVS Assembler program to read any flat file

Wanted MVS Assembler program to read any flat file

Does anyone have source to read any file into a general purpose program?

I have a COBOL smart compare but want to make it general purpose smart compare program.

Does anyone have an Assembler program or another way to do this?

I am only talking about simple flat files here.

RE: Wanted MVS Assembler program to read any flat file

I am not really sure what it is you are looking for the assembler to do. IBM have IEBGENER (or ICEGENER) that will read a flat file, but then your program would still have to read in the file in order to process it so I am unsure as to what it is you actually want.

Reading an input file in assembler is very easy, but then again it is easy in Cobol too so I am not sure what benefit writing the routine in assembler will achieve.

RE: Wanted MVS Assembler program to read any flat file

I think the key will be examining the OPEN and perhaps the GET and PUT macro. Has anyone examined this to know it well? I want to find the length and if it is variable or fixed when I open the file.

This is for a MVS mainframe OS/390 system. I forgot COBOL was on so many platforms but most COBOL is still on the mainframe so I assumed. Sorry.

I am interested in reading any size flat file either fixed or variable length and getting the DCB parameters from the program. I do have mainframe assembler skills but I have yet to venture too far down this path. After the file is opened it can be determined what type of file it is.

SYNCSORT, EDSs Waapdsut, DYL280, Easytrieve and many other utilities can process files without knowing the attributes first.

I have written a smart compare COBOL program that works but I must define the COBOL with some length. This does work but I must copy the OLD and NEW files to match the input format for COBOL and then supply the real attributes by a parm or card input. I could make the file variable but I would still have to copy the old fixed and new file using a SORT or something to the standard format for the COBOL progam. I want to bypass these extra steps copying the input to a certain format first. An assembler subprogram with a GL returning the file with a pointer might do the trick. I wish COBOL could.

Below is some basic assembler GET logic with a pointer.
I have seen sample code for after the open to test for a fixed or variable file as below but I am not sure it works yet. Also can I get other information like the LRECL supplied by the JCL when the file is opened? All I really need is the LRECL and if it is a fixed or variable file.  

Basic 370 Assembler code:
        USING NEWDSECT,4                   REGISTER 4 POINTS TO NEW
*        READ THE NEWFILE                                              *
         ST    14,READNEWS    
         CLI   SNEWEOF,C'Y'                 IF NEW FILE NOT EOF  
         BE    READNEWX                             
         GET   NEWFILE                          READ NEWFILE   
         LR    4,1                              POINT TO NEW DSECT
         B     READNEWX                     ELSE
READNEWX DS    0H                           END-IF
         L     14,READNEWS
         BR    14

RE: Wanted MVS Assembler program to read any flat file

Now I see what you are wanting. :)

What you need to do is issue a RDJFCB (Read JFCB) from there you can get all the information that you need about the input file. Here is a much trimmed sample.

         RDJFCB (INPUT2)             Now read the JFCB      
         LTR   R15,R15               Did it work?           
         BNZ   RDJFCB_FAILED         No - Skip to error out
         LA    R7,JFCBAREA           Load R7 with JFCB area
         USING INFMJFCB,R7           Addressability to JFCB
         LH    R1,JFCLRECL        Get record length into R1
         ST    R1,MYLRECL            Save record length
         DROP  R7                                           
         GETMAIN RC,LV=(R1),LOC=(RES,ANY) Get storage       
         LTR   R15,R15               Did the GETMAIN work?  
         BNZ   GETMAIN_FAILED        No - Skip to error out

:::::::: more program code

JFCBAREA DS    176X'00'                                     
         DS   0F                                            
EXLST    DC    X'87',AL3(JFCBAREA)                          
JFCB     DSECT                                              
         IEFJFCBN ,

Details on the JFCB can be found in the DATA AREAS Manual (Volume 3) (IBM Manual number SY28-1166-11)

Good luck

RE: Wanted MVS Assembler program to read any flat file

Thanks Kevin.

I will give this a try. Yak at me if you think of anything else I should know.

Thanks again.

RE: Wanted MVS Assembler program to read any flat file

Here is the code needed for getting the input file attirbutes and setting an output file to the same attributes as an input file.

*                                      V=X'40',VB=X'50,F=X'80',FB=X'90'
*                                      (RECORD LENGTH IS A HALF WORD)


Thanks for everyone pointing me in the right direction. Yak back if you want a copy of the finished program.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close