What is IBM i (AS400) record format - db2

I've started to do some programming in ILE RPG and I'm curious about one thing - what exactly is the record format? I know that it has to be defined in physical/logical/display files but what exactly it does? In an old RPG book from 97 I've found that "Each record format defines what is written to or read from the workstation in a single I/O operation"
In other book I have found definition that record format describe the fields within a record(so for example length, type like char or decimal?).
And last, what exactly means that "every record within a physical file must have an identical record layout"?
I'm a bit confused right now. Still not sure what is record format :F.

Still not sure what is record format :F
The F Specification: This specification is also known as the File specification. Here we declare all the files which we will be using in the program. The files might be any of the physical file, logical file, display file or the printer file. Message files are not declared in the F specification.
what exactly means that "every record within a physical file must have an identical record layout"?
Each and every record within one physical file has the same layout.
Let's make a record layout of 40 characters.
----|---10----|---20----|---30----|---40
20150130 DEBIT 00002100
20150130 CREDIT 00012315
The bar with the numbers is not part of the record layout. It's there so we can count columns.
The first field in the record layout is the date in yyyymmdd format. This takes up 8 characters, from position 1 to position 8.
The second field is 2 blank spaces, from position 9 to position 10.
The third field is the debit / credit indicator. It takes up 10 characters, from position 11 to position 20.
The fourth field is the debit / credit amount. It takes up 8 positions, from position 21 to position 28. The format is assumed to be 9(6)V99. In other words, there's an implied decimal point between positions 26 and 27.
The fifth field is more blank spaces, from position 29 to position 40.
Every record in this file has these 5 fields, all defined the same way.

A "record format" is a named structure that is used for device file I/O. It contains descriptions of each column in the 'record' (or 'row'). The specific combination of data types and sizes and the number and order of columns is hashed into a value that is known as the "record format identifier".
A significant purpose is the inclusion by compilers of the "record format identifier" in compiled program objects for use when the related file is opened. The system will compare the format ID from the program object to the current format ID of the file. If the two don't match, the system will notify the program that the file definition has changed since the program was compiled. The program can then know that it is probably going to read data that doesn't match the definitions that it knows. Nearly all such programs are allowed to fail by sending a message that indicates that the format level has changed, i.e., a "level check" failed.
The handling of format IDs is rooted in the original 'native file I/O' that pre-dates facilities such as SQL. It is a part of the integration between DB2 and the various program compilers available on the system.
The 'native' database file system was developed using principles that eventually resulted in SQL. A SQL table should have rows that all hold the same series of column definitions. That's pretty much the same as saying "every record within a physical file must have an identical record layout".
Physical database files can be thought of as being SQL tables. Logical database files can be thought of as being SQL views. As such, all records in a physical file will have the same definitions, but there is some potential variation in logical files.

A record format It's something you learn in old school. You read a file (table) and update/write through a record format.
DSPFD FILE(myTable)
Then you can see everything about the file. The record format name is in there.

New or Young Developers believe that every record in a physical file must be identical, but in ancient times, the dinosaurs walk on earth and in one single file you could have several types of records or "record formats", so as the name indicates a record format is the format of a record within a file.

Related

How to get the mapping relation between xbrl tag and name shown in financial statement?

The name shown in financial statement and xbrl tag name are different,take apple's 2019 financial statement as example.
apple 2019 financial statement
Click sections--financial statement--consolidated statements of operations and move mouse at the 274,515 ,
You can see
Tag
us-gaap:RevenueFromContractWithCustomerExcludingAssessedTax
Fact
274,515,000,000
The tag name is RevenueFromContractWithCustomerExcludingAssessedTax in xbrl term, it is called as Total net sales, maybe there exists a table mapping every xbrl tag name with name shown on financial statements,where can i get it?
Yes, there is a mapping between tag names (they are called concepts) and user-readable English names (they are called labels) in what is called the label linkbase.
You can click on the right arrow in the pop-up window that can be seen on your screenshot, which will display all the associated labels.
However, there is no guarantee that these labels match exactly what is seen on the HTML page, because this is Inline XBRL and the text surrounding the tagged data is completely free, as opposed to the tabular view an XBRL processor would automatically reconstruct from the taxonomy attached to the report. Ideally, the filings should be created in a way that the two should match, though.
In this case, "Total net sales" would be a Total label (i.e., used when the data is displayed in context as a total), but it does not seem that this label appears in the label linkbase here, at least as shown in the window.
Regarding a large, flat, tabular representation of the entire label linkbase of a filing: I did not manage to find it for this specific (version of the) viewer, however there are many XBRL processors that do offer this (e.g., export to CSV or Excel).

Multiple copies of a record based on formula

Good afternoon,
I am very new to Crystal Reports, so am not sure where to look for this information and would appreciate if someone can point me in the right direction or tell me if what I am asking for is impossible.
One of our departments uses a field called RecordChanges to note changes made to a record. The field is text and the department stores information there about the date a change is made and the type of change, separated by commas (i know this is terribly inefficient, but it's what I have to work with). I have a Crystal Report that parses this text field and picks up the latest date and latest change made to the record. I would like to modify this report to include ALL the changes made to the record, so if the field RecordChanges of the data source has 3 dates, I would like this record to appear in my Crystal Report 3 times, once for each change that was made. How to parse the field I can figure out but where I'm stuck is how do I make the number of times a record appears equal to the number of dates found which is my {#DateFound} field?
There is a lack of details, but as far as I understood the problem and assuming that you did state in the comment that "there wouldn't ever be more than 5 changes to an order", here is a first try to tackle the situation.
I will assume that you already have a formula that "parses this text field and picks up the latest date and latest change made to the record". And that you know how to adjust this formula to pick up each of the record changes. I will name this formula as {#Parser1}.
Based on {#Parser1}, create other 4 formulas: {#Parser2}, {#Parser3}, {#Parser4}, {#Parser5}. As you probably presume, each formula must be changed to parser the Nth occurrence of the record change.
Create 5 details sections.
Put each formula in each detail section.
Suppress the detail section wich formula is null or empty.
That's it.
The limitation is that you can have at most 5 record changes.
This is an awkward solution, but it is necessary (as far as I know) since Crystal Reports works based on your data rows. It iterates over the rows, but cannot "generate" more rows by itself. If you can manipulate the data source, you can create other solutions.
You still need to do the magic trick to pickup the Nth change from the text.

PostgreSQL copy from succeeds but fewer rows copied then lines in file

I have several large csv (tab delim) files I need to copy into one table. Each file is five million rows. The first two files copy just fine with all five million records. But on the the third I get missing data.
I only copy about 3.9 million instead of five million. There is no error. It runs just fine. But fewer rows copied then exist in the file.
I have reviewed the text files and indeed there are five million distinct rows in the text file.
So after a very manual trial and error process I found the the last row that wrote correctly (annoying the frame that didn't write was neither in the end or the beginign). It appears that perhaps their is an issue with a particular field. The field ends with the following string: ."' (this is period, double quote, single quote) I am using tab deliminted, but is it posible that postgress is reading this as some kind of special character? I think all of the subsequent rows may be writing into the that field for that row.
Just to add some more context -- the field in which the double quotes are throwing things off also happens to be an email field. So there a email with a typo in it and a double quote. Then 1.1 million rows later there is another email with a typo in it with a double quote. All the records between these two double quotes don't get written correctly.
That is not surprising if you consider that a logical line in a CSV file can span more than one physical line:
1,a text,2019-11-24
2,"a text
that contains a newline",2020-04-01

Field text is being truncated inconsistently

I created a label report (2 columns). The fields used are, Suffix, Contact Name, Company Name, Job Title and Department – simple contact data.
The Department field is the last one and in the report of 78 records the Department field decided not to display the entire field text twice.
I have "Can Grow" set as default on all fields, I checked the margins and label width to ensure the text is not being truncated because of the labels being too wide for the margins. I modified the data in the database by abbreviating certain words and it shows the change but it still truncates after 50 characters. Other times the Department name is 80+ characters and it displays all of the data.
This problem is happening onscreen when I preview the report and also when various users print it. The default printers have not changed.
This one has me stumped. Is this an application bug (if so is there a Service Pack for CR 11.5?) or does it have anything to do with printer drivers in need of update?
Thanks in advance for your help on this puzzle.
Update
I did specify data source
The text in the database is without any special characters or anythig else that might be out of place
No I am not using Underlaying Following sections anywhere in the document
11.5.8.998 is my version of CR (lloks like I am behind - however, when I click on verify for updates it tells me there aren't any. Do you ahve a link to the SP2 download?)
No formula in the Custom string option
Mine worked by simply going to the Database Menu option: Database-->Verify Database, and the field sizes were updated
It could happen if the length of the field in the Data Source is less than your string. To check this:
In the Field Explorer right click on the data source name and choose "Show Field Type"
The length of the field is written between ( ). If it is less than your string length, you have to re-build your data source. For example, if your data source is a view, you have to drop and create it again and then verify your data base in crystal report.
Hope it helps.
Random troubleshooting thoughts. One of these could even work :)
You didn't specify your datasource, but can you preview your data before it goes into Crystal? If the actual data is randomly truncated, then the problem isn't Crystal, it's the data.
Does this data have any special characters, i.e. accents, foreign currencies, etc? That could be a problem (I don't know if this could even create problems, never used them in Crystal)
In the Section Expert, are you using the Underlaying Following Sections option for fancy formatting? If so, your 'grown' fields may be hidden by some other field in the following section.
My Crystal Reports XI Developer Edition is 11.5.12.1838 (that's service pack 2). Is your Crystal up to date?
In the Format Field pane, there is an option to make a custom Display String. Sometimes I forget I have a formula and then don't understand why it's not doing what i want.

Filemaker: making queries of large data more efficient

OK I have a Master Table of shipments, and a separate Charges table. There are millions of records in each, and it's come into Filemaker from a legacy system, so all the fields are defined as Text even though they may be Date, Number, etc.
There's a date field in the charges table. I want to create a number field to represent just the year. I can use the Middle function to parse the field and get just the year in a Calculation field. But wouldn't it be faster to have the year as a literal number field, especially since I'm going to be filtering and sorting? So how do I turn this calculation into its value? I've tried just changing the Calculation field to Number, but it just renders blanks.
There's something wrong with your calculation, it should not turn blank just because field type is different. I.e.:
Middle("10-12-2010", 7, 4)
should suffice, provided the calc result is set to Number. You may also wrap it into GetAsNumber(...), but, really, there's no difference as long as field type is right.
If you have FM Advanced, try to set up your calc in the Data Viewer (Tools -> Data Viewer) rather than in Define Fields, this would be faster and, once you like the result, you can transfer it into a field or make a replace. But, from the searching/sorting standpoint there's no difference between a (stored) calculation and a regular field, so replacing is pointless and, actually, more dangerous, as there's no way to undo a wrong replace.
Here's what i was looking for, from
http://help.filemaker.com/app/answers/detail/a_id/3366/~/converting-unstored-calculation-fields-to-store-data
:
Basically, instead of using a
Calculation field, you create am EMPTY
Number, date or text field and use
Replace Field Contents from the Records menu, and put
your calculation (or reference, or
both) there.
Not dissing FileMaker at all, but millions of records means FileMaker is probably the wrong choice here. Your system will be slow, slow, slow. FileMaker is great for workgroups and there is no way to develop a database app faster. But one thing FileMaker is not good at is handling huge numbers of records.
BTW, Mikhail Edoshin is exactly right.