× 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.



One file we get from a vendor has 4 different record types. My approach is this....

Import flat file into a single field file (1024, 2048, whatever is needed)
Using LIKEREC()
Define a DS for that flat file
Define 4 structures based on that address
Read the flat file
Test the first byte
Call the applicable procedure which uses the applicable structure

After you write the individual PF's, you have use of any tool you want for the data - SQL, RPG, whatever.

It's so easy, I don't even think about it anymore.


Roger Harman

COMMON Certified Application Developer - ILE RPG on IBM i on Power






________________________________
From: MIDRANGE-L <midrange-l-bounces@xxxxxxxxxxxxxxxxxx> on behalf of Vernon Hamberg <vhamberg@xxxxxxxxxxxxxxx>
Sent: Wednesday, December 30, 2020 11:12 AM
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxxxxxxxx>
Subject: Re: Multiple formats in PF or LF

So things go, right? I have had some kind of idea of using some kind of
record identifier - were you processing the flat file with those IDs in
I-specs? As I recall, for each read we would have a condition on that
ID, then process as needed.

Could there be data structures built over the various record layouts?
Built the same as what is in the I-specs?

Yeah, I know, old old old school! Maybe tear the building down to do the
job better!

Cheers and back to work I go!

Vern

On 12/30/2020 1:04 PM, smith5646midrange@xxxxxxxxx wrote:
This goes to my concept of having 30 years of experience or 1 year of experience 30 times. We did the flat file copy to individual PFs many, many, many years ago. I thought I had seen a different way of doing it and wanted to give it a try. I failed but at least now I know it can't be done with multiple formats in one file.

-----Original Message-----
From: MIDRANGE-L <midrange-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Alan Campin
Sent: Wednesday, December 30, 2020 11:08 AM
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxxxxxxxx>
Subject: Re: Multiple formats in PF or LF

Not sure I understand the issue here. The vendor is sending you a flat file. Don't you need to just create normalized tables and write a transform program that reads the flat file and writes the records to normalized tables. Why would you need to mess with the flat files other than transforming them?

On Wed, Dec 30, 2020 at 7:53 AM Christopher Bipes < chris.bipes@xxxxxxxxxxxxxxx> wrote:

Look at data dictionaries. You can also build LF with select
statements, one for each record format.

Bringing back nightmares

Sent from my iPhone

On Dec 29, 2020, at 7:29 PM, smith5646midrange@xxxxxxxxx wrote:

"I don't understand why anyone would consider a single "flat file'
with multiple record formats for a header/detail/payment type of file."
Answer: It is a flat file provided by a third party vendor. If I had
any say in the matter, it wouldn't be this way but I don't and it is
and we get to live with it.

I'll give up and do it the hard way with multiple physicals and
multiple CPYFs selecting the record type for each physical and then
process it like any other data set. The thought was to not have to
split the data from one file to multiple files and I thought I had
seen this done but apparently I'm wrong and the ability doesn't exist.
Maybe my brain is going back to my old COBOL days and the REDEFINES on
the 01 level.

Thanks anyhow.



-----Original Message-----
From: MIDRANGE-L <midrange-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of
Dan
Sent: Tuesday, December 29, 2020 7:35 PM
To: Midrange Systems Technical Discussion
<midrange-l@xxxxxxxxxxxxxxxxxx>
Subject: Re: Multiple formats in PF or LF

I'm working with a head cold right now, so not sure if this is what
you're looking for.

I didn't quite make the connection in my last email, so allow me to
clarify.

I don't understand why anyone would consider a single "flat file' with
multiple record formats for a header/detail/payment type of file. The
System/36 died a long time ago. Alan's suggestion to try SUBSTR gives
me shudders, like, shoot me now kind of shudders. Do you hate the
people who will inherit your code? ;-)

Have you considered creating three DDS PFs / SQL tables: Header,
Detail, Payment

Having defined those, you can create a multiple-format LF using DDS.
But, per my last email, I don't know whether SQL would play nice with that.

It sounds to me like your solution might be to JOIN the PFs / tables
in a CREATE VIEW, and eschew the multi-format LF altogether. You
might be able to use lateral correlation in place of joining the files in the view.

- Dan

On Tue, Dec 29, 2020 at 6:52 PM Dan <dan27649@xxxxxxxxx> wrote:

A PF can have only one record format, but an LF can have multiple
record formats.

Because it's been ages since I last used them, I can only point you
to IBM's DDS for Physical and Logical files Reference. Search for
"multiple-format logical files in DDS" to find a code sample.

I'm not sure whether SQL can process a multiple format LF.
Hopefully, others can assist.

- Dan

On Tue, Dec 29, 2020 at 6:37 PM <smith5646midrange@xxxxxxxxx> wrote:

I'm starting to think that I am searching for something that
doesn't exist.

I thought there was a way of having a single "flat file" and
breaking it into multiple record formats in the DDS so the
individual records could be accessed via SQL

For example: a flat file that would contain sales data

HdrFmt
RcdType
SaleNumber
SaleDate
DtlFmt
RcdType
SaleNumber
Item
Quantity
Price
PayFmt
RcdType
SaleNumber
PaymentType
Amount

If I wanted to query all of the detail records to find out what
items were sold, I could do something like select item, count(*)
from flatfile where rcdtype = 'DTL' group by item

Am I just thoroughly confused thinking I have seen something like
this in the past? If not, can someone please provide the DDS to
show me how it is done? Nothing that I have tried has worked. I
know I can create separate PFs and copy the appropriate data to
each file via a CPYF *NOCHK selecting the appropriate rcdtype but
that defeats the purpose of what I am trying to do.

--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx To
subscribe, unsubscribe, or change list options,
visit: https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.midrange.com%2Fmailman%2Flistinfo%2Fmidrange-l&amp;data=04%7C01%7C%7C143ad2d50c4847d6290908d8acf6da71%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637449523511343518%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=pboY039L%2F7A%2FPYTrisNTU%2FrGQUZnSMtcQGkRSFX1xwU%3D&amp;reserved=0
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Farchive.midrange.com%2Fmidrange-l&amp;data=04%7C01%7C%7C143ad2d50c4847d6290908d8acf6da71%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637449523511343518%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=Ica1vknWpg%2B2Q0ty9nZ3uWmhfGO0TAomfiKtU65i7V8%3D&amp;reserved=0.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription
related questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link:
https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Famazon.midrange.com%2F&amp;data=04%7C01%7C%7C143ad2d50c4847d6290908d8acf6da71%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637449523511343518%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=LKXr4qzFSjPdAnuauqVj1UUf1DkFG5jRx9oYrZLIrq0%3D&amp;reserved=0

--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx To
subscribe, unsubscribe, or change list options,
visit: https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.midrange.com%2Fmailman%2Flistinfo%2Fmidrange-l&amp;data=04%7C01%7C%7C143ad2d50c4847d6290908d8acf6da71%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637449523511343518%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=pboY039L%2F7A%2FPYTrisNTU%2FrGQUZnSMtcQGkRSFX1xwU%3D&amp;reserved=0
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Farchive.midrange.com%2Fmidrange-l&amp;data=04%7C01%7C%7C143ad2d50c4847d6290908d8acf6da71%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637449523511343518%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=Ica1vknWpg%2B2Q0ty9nZ3uWmhfGO0TAomfiKtU65i7V8%3D&amp;reserved=0.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription
related questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Famazon.midrange.com%2F&amp;data=04%7C01%7C%7C143ad2d50c4847d6290908d8acf6da71%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637449523511353511%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=R8%2BBKpkMW1tDAPbJqmLGb0KxXPvCxCwpyPhGhxT3gBE%3D&amp;reserved=0
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx To
subscribe, unsubscribe, or change list options,
visit: https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.midrange.com%2Fmailman%2Flistinfo%2Fmidrange-l&amp;data=04%7C01%7C%7C143ad2d50c4847d6290908d8acf6da71%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637449523511353511%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=F93nZm72Kg1Gitrj%2FQAVLMWMT28BrZMCA4LeB%2BT66K4%3D&amp;reserved=0
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Farchive.midrange.com%2Fmidrange-l&amp;data=04%7C01%7C%7C143ad2d50c4847d6290908d8acf6da71%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637449523511353511%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=hMttj4blxawKb3u8gSJXziDVl%2BS6uIXtMlNMsWlItXg%3D&amp;reserved=0.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription
related questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Famazon.midrange.com%2F&amp;data=04%7C01%7C%7C143ad2d50c4847d6290908d8acf6da71%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637449523511353511%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=R8%2BBKpkMW1tDAPbJqmLGb0KxXPvCxCwpyPhGhxT3gBE%3D&amp;reserved=0

--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.midrange.com%2Fmailman%2Flistinfo%2Fmidrange-l&amp;data=04%7C01%7C%7C143ad2d50c4847d6290908d8acf6da71%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637449523511353511%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=F93nZm72Kg1Gitrj%2FQAVLMWMT28BrZMCA4LeB%2BT66K4%3D&amp;reserved=0
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Farchive.midrange.com%2Fmidrange-l&amp;data=04%7C01%7C%7C143ad2d50c4847d6290908d8acf6da71%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637449523511353511%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=hMttj4blxawKb3u8gSJXziDVl%2BS6uIXtMlNMsWlItXg%3D&amp;reserved=0.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.

Help support midrange.com by shopping at amazon.com with our affiliate link: https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Famazon.midrange.com%2F&amp;data=04%7C01%7C%7C143ad2d50c4847d6290908d8acf6da71%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637449523511353511%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=R8%2BBKpkMW1tDAPbJqmLGb0KxXPvCxCwpyPhGhxT3gBE%3D&amp;reserved=0


--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.midrange.com%2Fmailman%2Flistinfo%2Fmidrange-l&amp;data=04%7C01%7C%7C143ad2d50c4847d6290908d8acf6da71%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637449523511353511%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=F93nZm72Kg1Gitrj%2FQAVLMWMT28BrZMCA4LeB%2BT66K4%3D&amp;reserved=0
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Farchive.midrange.com%2Fmidrange-l&amp;data=04%7C01%7C%7C143ad2d50c4847d6290908d8acf6da71%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637449523511353511%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=hMttj4blxawKb3u8gSJXziDVl%2BS6uIXtMlNMsWlItXg%3D&amp;reserved=0.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.

Help support midrange.com by shopping at amazon.com with our affiliate link: https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Famazon.midrange.com%2F&amp;data=04%7C01%7C%7C143ad2d50c4847d6290908d8acf6da71%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637449523511353511%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=R8%2BBKpkMW1tDAPbJqmLGb0KxXPvCxCwpyPhGhxT3gBE%3D&amp;reserved=0

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.