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
 
How to read record from mixed format file?

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

New User


Joined: 20 Apr 2006
Posts: 6
Location: chennai

PostPosted: Fri Aug 04, 2006 2:39 pm    Post subject: How to read record from mixed format file?
Reply with quote

inputfile:-

1 xxxxxx 060306 1981
2 beer 002 60.00 2
2 brandi 004 190.00 1
2 whisky 003 140.00 1
1 yyyyy 070306 1982
2 beer 002 60.00 2
2 brandi 004 190.00 1
2 whisky 003 140.00 1
1 zzzz 110306 1982
2 beer 002 60.00 2
2 brandi 004 190.00 1
2 whisky 003 140.00 1

input file contains 2 structures:

structure 1:- for rec_id = 1

Rec_id
name
date
orderno

structure 2:- for rec_id = 2

Rec_id
item
item_code
rate
quantity

OUtput:-
-----------------------------------------------------
customer: xxxxx date:060306
order: 1981
---------------------------------------------------
slno item item_code rate quantity amount
1 beer 002 60.00 2 120.00
2 brandi 004 190.00 1 190.00
3 whisky 003 140.00 1 140.00
---------------------------------------------------
Total: 450.00
----------------------------------------------------


Question:-
-----------
How to read the record from the mixed format file(file contains two informations)?...
Back to top
View user's profile Send private message

shaham25

New User


Joined: 20 Apr 2006
Posts: 6
Location: chennai

PostPosted: Tue Aug 08, 2006 6:57 pm    Post subject: Re: How to read record from mixed format file?
Reply with quote

Here is the answer for my question.

Record structure:-
------------------
DCL 1 INREC1,
5 REC_ID CHAR(1),
5 FILLER CHAR(79);

DCL 1 OUTREC,
5 SL_NO CHAR(2),
5 FILLER1 CHAR(8),
5 ITEM1 CHAR(10),
5 FILLER2 CHAR(7),
5 RATE1 PIC 'ZZ9V.99',
5 FILLER3 CHAR(10),
5 QUANTITY1 PIC 'ZZ9V.99',
5 FILLER4 CHAR(13),
5 AMOUNT PIC 'ZZZZ9V.99';
/* 5 FILLER5 CHAR(3);*/

DCL 1 OUTREC1,
5 REC_ID1 CHAR(1),
5 CUST_NAME1 CHAR(20),
5 YEAR CHAR(2),
5 MONTH CHAR(2),
5 DAY CHAR(2),
5 ORDERNO1 CHAR(4),
5 FILLER CHAR(49);

To get the record1:-
-------------------

IF INREC1.REC_ID = 1
THEN DO;
OUTREC1 = ' ';
OUTREC1.CUST_NAME1 = SUBSTR(INREC1.FILLER, 1,20);
OUTREC1.YEAR = SUBSTR(INREC1.FILLER, 21,2);
OUTREC1.MONTH = SUBSTR(INREC1.FILLER, 23,2);
OUTREC1.DAY = SUBSTR(INREC1.FILLER, 25,2);
OUTREC1.ORDERNO1 = SUBSTR(INREC1.FILLER, 27,4);

To get the record2:-
-------------------

IF INREC1.REC_ID = 2
THEN DO;
OUTREC = ' ';
OUTREC.ITEM1 = SUBSTR(INREC1.FILLER, 1,10);
OUTREC.RATE1 = SUBSTR(INREC1.FILLER, 11,3);
OUTREC.QUANTITY1 = SUBSTR(INREC1.FILLER, 14,3);

Incase of any clarification , please ask me
Back to top
View user's profile Send private message
Murali krishna

New User


Joined: 17 Feb 2006
Posts: 9
Location: chennai

PostPosted: Tue Sep 19, 2006 5:19 pm    Post subject:
Reply with quote

Declare a structure with the extact LRECL.
Declare Structure one as input1 format and while declaring use Based on parameter.
Do the same for structure two.

Hope it works.
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 Copy 4 byte of data from the last rec... arunsoods DFSORT/ICETOOL 9 Fri Oct 06, 2017 12:15 pm
No new posts Execute JCL step based on the content... sprikitik JCL & VSAM 2 Tue Oct 03, 2017 10:03 am
This topic is locked: you cannot edit posts or make replies. PS file data should be passed as symb... d_sarlie JCL & VSAM 15 Tue Oct 03, 2017 5:18 am
No new posts Garbage on output file Hervey Martinez SYNCSORT 4 Wed Sep 27, 2017 12:50 am
No new posts File Aid tool to compare numeric data balaji81_k Compuware & Other Tools 2 Tue Sep 26, 2017 3:35 am

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