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
 

 

HOW TO MOVE NON-FIXED DATA?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler
View previous topic :: :: View next topic  
Author Message
ann

New User


Joined: 10 Aug 2005
Posts: 3

PostPosted: Wed Aug 10, 2005 10:55 pm    Post subject: HOW TO MOVE NON-FIXED DATA?
Reply with quote

Hi,

CAN U TELL ME HOW TO MOVE VARIABLE LENGTH DATA TO WORK AREA ? AND IT MAY OVER 256BYTES......... I KNEW THAT IF THE DATA IS BELOW 256 BYTES AND FIXED LENGTH MOVEMENT AS FOLLOWING......

EX:
MVC OUTPUTDATA+4(10),INPUTDATA
IT TAKES FIXED "10" BYTES LENGTH DATA FROM INPUTDATA

IF I WANT TO MOVE NON-FIXED DATA LENGTH TO OUTPUTDATA+4, HOW CAN I DO?

IS

MVC OUTPUTDATA+4('LINPUTDATA),INPUTDATA ??


HOW ABOUT OVER 256 BYTES????





THANKS ALL.
Back to top
View user's profile Send private message

ironmike

New User


Joined: 07 Aug 2005
Posts: 33

PostPosted: Thu Aug 11, 2005 4:24 am    Post subject:
Reply with quote

Well, you could use the MVCL instruction, but you do have to set a limit on the defined length of the work area in most cases. I presume you are moving all or part of a variable length record that you have obtained with a GET macro, correct? Your labels are OUTPUTDATA and INPUTDATA, but you don't say how you got the variable length data to begin with. I will assume a QSAM GET with MACRF=L in the DCB for now. If you are using GETs with VSAM, the rules change.

Now, if you did a GET with DCB MACRF=L, then the address of the record you read is returned in R1 (register one). You should save that address in another register, then use MVCL to move all or part of the data to your work area. MVCL works if you are only moving one byte, or if you are moving up to 2,147,483,647 bytes.
Code:

             ...
             GET   INFILE                         READ RECORD
             LR     R2,R1                         SAVE ITS ADDRESS
             LH     R3,0(,R2)                    GET SIZE OF RECORD
             L      R5,=A(L'OUTPUTDATA)   GET LENGTH OF OUTPUT AREA
             CR     R3,R5                         SEE IF RECORD WILL FIT
             BH     NOMVCL                      SKIP MVCL IF NOT
             LA     R4,OUTPUTDATA           GET ADDRESS OF OUTPUT AREA
             MVCL   R4,R2                          MOVE THE FULL RECORD THERE
NOMVCL       DS     0H
             ....

The code above GETs the record, save it's address in register 2, then puts the length of the record in R3 by loading it from the halfword RDW (record descriptor word) which is at the front of each variable length record read via QSAM GET. The length of the output area is placed in R5 and a compare is done to make sure the record will fit into the output area. If it fits, then R4 is set to the address of the output area and MVCL (move long) is used to move the record from the QSAM buffer to the output area. If the record won't fit, then the MVCL is skipped.

MVCL, as coded above, moves TO the address in R4 FROM the address in R2. R3 and R5 contain the sending and receiving lengths, respectively.

This is an over simplified example. You could just as well move part of the record also. The optimum way to handle this is to just access the record where it sits in the QSAM buffer (R1 points to the record after GET executes) and move fields from it to your output area. You should read up on MVCL before you use it, AND adapt the ideas in this example to your code...this is an example only, not a usable program...
Back to top
View user's profile Send private message
dinesh_mf

New User


Joined: 26 May 2005
Posts: 15
Location: maharashtra

PostPosted: Mon Aug 22, 2005 10:13 pm    Post subject: Re: HOW TO MOVE NON-FIXED DATA?
Reply with quote

Hi Ironmike,
Thats a very good and comprehensive explaination. Thanks.

Dinesh
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 -> PL/I & Assembler All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts Replace values in the input data Vikas Maharnawar DFSORT/ICETOOL 10 Thu May 11, 2017 2:18 pm
No new posts Group Data based on a key Arun Raj DFSORT/ICETOOL 7 Thu Apr 27, 2017 11:29 pm
No new posts unload data from table with lob columns farhad_evan DB2 0 Sat Apr 22, 2017 1:32 pm
No new posts SORT JSON type of data maxsubrat DFSORT/ICETOOL 8 Wed Apr 19, 2017 6:01 pm


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