|
How do I set the address to the 1st character of Cust-nbr, which is the first field following the fixed portion. Is that a hard-coded off-set?
Thanks!
-----Original Message-----
From: cobol400-l-bounces@xxxxxxxxxxxx [mailto:cobol400-l-bounces@xxxxxxxxxxxx] On Behalf Of Jon Paris
Sent: Thursday, February 28, 2013 8:25 PM
To: COBOL Programming on the IBM i (AS/400 and iSeries)
Subject: Re: [COBOL400-L] how to reference a string AFTER a specific field name
Personally I would use the same kind of technique as I would for a trigger Joel.
This is a quick note (I'm starving - not having eaten yet) so if you need more detail holler but hopefully you'll get the idea.
In Linkage use a COPY DDS for each of the files whose images are contained in the journal records.
Use READ not READ INTO and set the address of the 01 linkage item you are processing this time to the address of the first character following JOTIME (or whatever the last field in the fixed portion is). Now you can process the Linkage version of the record's fields any way you want.
Even if the first part of the record is fixed it is probably a good idea to take and set the address with each input record. COBOL's FD is simply mapped to the record in the buffer (unlike RPG which moves the data to the fields) consequently the address of the record will change when the file is blocked.
Of course you could use READ INTO in which case the address of the WS item you read into will never change - but the program will be slower and usually with journal processing you have a lot of data to get through.
Hope this helps.
On 2013-02-28, at 5:07 PM, Stone, Joel wrote:
In a record format, I have several journal fields (replicated from a few of the DSPJRN outfile fields) and then several user fields for our app.
There are several file formats, one for each user file.
But, I want to use only one pgm routine to process all these files.
So, here is a file samples:
***** Cust file ******
01 record-fields.
05 JOENTTY pic x(2).
05 JODATE pic x(6).
05 JOTIME pic x(10).
05 Cust-nbr pic x(10).
05 Cust-name pic x(30).
...
The JOURNAL fields all line up in columns from one file to another, (start in the same position), but the user fields do not (the first user field always starts after JOTIME).
Does COBOL provide a way to reference everything AFTER the JOTIME field? WITHOUT using a hard-coded number?
For example, I am using
If record-fields (19:) =
Which is bad news if the journal fields expand.
I would prefer something like:
If record-fields (all fields after JOTIME -> to the end of record)
Note: the field Cust-nbr is other names in other files, such as Item-nbr, vendor-nbr, etc.
Clear as mud I am sure.
Can I rename the concatenation of all fields after JOTIME to a new name to use?
Any other ideas how to avoid reference by offset, which will be problematic down the road?
Thanks
______________________________________________________________________
This outbound email has been scanned for all viruses by the MessageLabs Skyscan service.
For more information please visit http://www.symanteccloud.com
______________________________________________________________________
--
This is the COBOL Programming on the IBM i (AS/400 and iSeries) (COBOL400-L) mailing list
To post a message email: COBOL400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/cobol400-l
or email: COBOL400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/cobol400-l.
Jon Paris
www.partner400.com
www.SystemiDeveloper.com
--
This is the COBOL Programming on the IBM i (AS/400 and iSeries) (COBOL400-L) mailing list
To post a message email: COBOL400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/cobol400-l
or email: COBOL400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/cobol400-l.
________________________________________________________________________
This inbound email has been scanned for all viruses by the MessageLabs SkyScan
service.
________________________________________________________________________
______________________________________________________________________
This outbound email has been scanned for all viruses by the MessageLabs Skyscan service.
For more information please visit http://www.symanteccloud.com
______________________________________________________________________
--
This is the COBOL Programming on the IBM i (AS/400 and iSeries) (COBOL400-L) mailing list
To post a message email: COBOL400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/cobol400-l
or email: COBOL400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/cobol400-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.