× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Thanks for all the assistance.

Maybe I am trying to be too clever (maybe not the right word:). I am trying to process 16 user files - all with one cobol procedure division that is COPY'd into 16 different shell pgms (with little guts to them) and I MOVE CORR to get all the fields moved - so I don't need to know field names because they change for each file.

So I don't know the first field name after the fixed fields.


For example I want to know if anything past the JOTIME field has changed between the BEFORE and the AFTER image. So I cant use the "address of Cust-nbr" because it will be a different "1st field" for the Item file.

Maybe I can code "Address of JOTIME" and add "Length of JOTIME" to that to get to the first user field???




***** 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).



***** Item file ******

01 record-fields.
05 JOENTTY pic x(2).
05 JODATE pic x(6).
05 JOTIME pic x(10).

05 Item-nbr pic x(10).
05 Item-price pic 9(5)v99.



Etc






-----Original Message-----
From: cobol400-l-bounces@xxxxxxxxxxxx [mailto:cobol400-l-bounces@xxxxxxxxxxxx] On Behalf Of Jon Paris
Sent: Friday, March 01, 2013 10:41 AM
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

Don't ever assume that IBM won't change anything Joel!

But yes - as long as you are taking the address of the first field _after_ the IBM potion it should work just fine with a simple recompile.

Linkage section was originally used for input parm definitions. In other words for accessing any storage outside of the program. In more recent years it has been expanded to allow its use with any storage that can be accessed via a pointer. Working storage by definition is in a fixed memory location so it is not really applicable there. It is implied within the COBOL manual that some other areas can be used but there are many caveats to it and I see no point. Knowing the way the internals of the OPM compiler worked there is no way Working Storage could have the addresses changed. It might have worked with FD areas but ... Keep to Linkage and you'll have no troubles.


On 2013-03-01, at 11:02 AM, Stone, Joel wrote:

So if IBM changes JODATE in version 8.1 from length 6 to a more standard length 8, the pgm should keep running after a recompile with no source code changes correct?

Is there something special with the linkage section ? Or can this be done anywhere - working storage for example.

Are the journal field lengths so locked in that IBM would probably never change them? JOENTT, JOTIME, JOUSER, JOTRR, etc? Or is it best not to count on that.

Thanks for the example!!



-----Original Message-----
From: cobol400-l-bounces@xxxxxxxxxxxx [mailto:cobol400-l-bounces@xxxxxxxxxxxx] On Behalf Of Jon Paris
Sent: Friday, March 01, 2013 9:44 AM
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

No - simpler than that Joel.

I've tried to show an equivalent to my understanding of what you are trying to do in this sample. Hope it helps. By the way I tested it and it works just fine. Note that the Linkage items are NOT included in the Procedure Division statement.

Identification Division. Program-Id. PTRPLAY.
Data Division.
Working-Storage Section.
01 inputRecord.
05 fixedBit Pic X(20).
05 variableBit Pic X(20)
Value 'Field1Field2999999'.
Linkage Section.
01 dummyRecord.
05 field1 Pic X(6).
05 field2 Pic X(6).
05 field3 Pic 9(6).
Procedure Division.
P-Main.
Set Address of dummyRecord to Address of variableBit.
Display 'field2 = ', field2, ' - field3 = ', field3.
Stop Run.


On 2013-03-01, at 10:16 AM, Stone, Joel wrote:

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.


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.


Jon Paris

www.partner400.com
www.SystemiDeveloper.com





As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.