Earlier today, I changed a source-member in a PDSE in z/OS 2.2. I can see from Data Set List Utility that it was changed by me today.
Name Prompt Size Created Changed ID
MYPROGRM 50 2021/09/08 2022/07/26 11:44:03 MYUSRID
When browsing the source-member, I can see that some of the lines have a date on the far-right side of the screen, but they don't appear to be consistent. If I manually change a line, it doesn't always update that date.
RUNSTATS TABLESPACE XXXX.YYYYYY
TABLE(ALL) INDEX(ALL) 00011004
SHRLEVEL REFERENCE
Is there any way to tell what lines of my PDSE member where changed (for instance) today?
Thank you for your help!
Dave
You might be able to see what lines were changed or added but not deleted. If you have 'STATS ON' and sequence numbers on for the member you are editing, then the sequence numbers on the far right of the screen correspond to the MM values for the member:
VV.MM Version number and modification level. The version number is set
to 1 and the modification level is set to 0 when the member is
created. The modification level is the number of times this version
has been modified. For example, 02.15 means version 2, modification
15. If a member name is just an alternate name for another member, ALIAS appears in this field.
https://www.ibm.com/docs/en/zos/2.2.0?topic=statistics-member-list-display-panel-fields
The standard sequence field is the last 8 characters for fixed-length
records, or the first 8 characters for variable-length records,
regardless of the programming language. Use NUMBER ON STD to generate
sequence numbers in the standard sequence field. For members of
partitioned data sets, the format of standard sequence numbers depends
on whether statistics are being generated. If statistics are being
generated, standard sequence numbers are 6 digits followed by a
2-digit modification level number. The level number flag reflects the
modification level of the member when the line was created or last
changed. If, for example, a sequence number field contains 00040002,
the line was added or last changed at modification level 02. The
sequence number is 000400.
If STATS mode is off, or if you are editing a sequential data set,
standard sequence numbers are 8 digits, right-justified within the
field.
https://www.ibm.com/docs/en/zos/2.1.0?topic=numbers-sequence-number-format-modification-level
So if this is true for the member you are editing, and you want to know what was a changed in the last edit session, then check the Modification level of the member in question in the member display list (you may have to scroll left or right):
Name Prompt Size Init Mod VV MM ID
_________ TEST *Edited 8 7 2 01.02 JOCS065
**End**
aadn you can see the 00, 01, 02 etc. MM levels in columns 79-80
****** ***************************** Top of Data ******************************
000100 my data 00010000
000200 my data 00020000
000300 my data 00030000
000400 my data 00040000
000500 my data 00050000
000510 more data 00051001
000600 my changed data 00060002
000700 my data 00070000
****** **************************** Bottom of Data ****************************
so to see only what was last changed (useful in a large dataset), get the MM level (e.g. 45) end then, when editing, run the commands x all;f '45' 79 all
Those characters in positions 72 - 80 are not necessarily dates. They could be, but if they are it's because someone manually made that true. ISPF Edit does not enforce that.
It's more likely that at some point someone turned NUMBER ON on the member, or that some of the lines were copied from another member that at some point had NUMBER ON turned on.
To your question, it is common for HSM backups to be made of datasets when they are changed. You may be able to recover a recent backup of your PDSE to a different name and then use the compare ISPF Edit primary command to compare the two versions and determine what changed.
There is no way to tell which lines were changed by looking at the file. The number in far-right of the screen is likely a sequence number. If other lines in your file do not have similar numeric values it is likely that your profile is set to NUMEBR OFF.
To see your profile type prof command on the ISPF editor command line, it should display information similar to this:
> Command ===> prof Scroll ===> CSR
****** ***************************** Top of Data ******************************
=PROF> ....C (FIXED - 80)....RECOVERY ON....NUMBER ON STD......................
=PROF> ....CAPS OFF....HEX OFF....NULLS ON STD....TABS OFF.....................
=PROF> ....AUTOSAVE ON....AUTONUM ON....AUTOLIST OFF....STATS ON...............
=PROF> ....PROFILE UNLOCK....IMACRO NONE....PACK OFF....NOTE ON................
=PROF> ....HILITE C LOGIC PAREN CURSOR FIND MARGINS(1,72)......................
That will tell you if sequence numbers are ON or OFF. If you want to get rid of sequence numbers you can use do the following sequence of commands: num followed by unnum command, otherwse if you want sequence nymbers use just the num command.
I have a table with a column for ID, it is a varchar, this column however has to be 14 characters long. The vendor that supplies this table left some with 15 characters. The format of the number is 'FL000000123456.' So, we asked them and they told us to just remove off the leading zero. I need to run an update on this table to remove that first zero, but I do not how to do that. I ran the LEN function to bring me back the ones that have a LEN of > 14. I can replace or run an update on the individual basis, but the table has over 1 million records and about 45,000 of them have the > 14 error. I do not work on SQL most of my time, so I am not as adept as some of you will be, but any help I can get would be greatly appreciated.
output: FL0000000123456 -- 15 chars
desired output: FL000000123456 -- 14 chars
Assuming that therefore you want to remove the 3rd character, you could use STUFF:
SELECT STUFF(YourColumn,3,1,'') AS NewColumn
FROM dbo.YourTable
WHERE LEN(YourColumn) = 15;
Of course, this does mean if you have a value like 'FL1234567891234' you would end up with 'FL234567891234', but I am assuming that won't happen.
I have a flat file which doesn't have the header record. The data except the trailing record is like a fixed width flat file with no delimiters.
Data in flat file looks like:
TOM ROLLS
DAVECHILLS
TOTAL2XYZ
Fixed Width data(first 2 lines as shown in the above flat file data)
ColumnName Start position End position
Name 1 4
Last_name 5 9
I want to load the data(till trailing record) in data_table and the trailing record(starting with Total) in another table. The data in the total table should look like
c1 c2
2 XYZ
For the data table, I am currently using "fixed width" and dividing the data into different column and it is working fine. Can you please help to load this last trailing record in a different table(Total table as discussed above)
You have not provided enough data for me to test because I can find several methods to load one row and accomplish what you are asking but those methods not necessarily work with multiple rows depending on the structure of you source data.
On the surface it appears that you simply need to make another flat file connection and define the starting and end position to extract only the data for the second table.
I would need your help with and SQL query that has to remove duplicate entries from a table, mostly using the datestamp column as a criteria in two passes.
Microsoft SQL DBMS is in question.
Here is a little more details:
Terminology: Module is basically a group of single machine workplaces onto which users operate.
Table:
ModNam column is fixed, there are 15 modules from M A01 to M A15, then goes the B row M B01 ... M B15 and so on until row F.
Pos column is irrelevant at the moment.
MdCod column represents a code of the machine being added to the position in the certain module. It can be replaced by another machine at any given time.
I have one query that will be inserting data into this table by copying entries from another table, every time a new machine is added to one of the positions.
Tricky part for me is a second query that should be comparing records in two phases and if:
1) Inside same module (first pass of the query represented with red color in the example pic attached):
ModNam value is the same, MdCod matches between the entries then the most recent datestamp decides the single one to stay and others duplicates get deleted
2) Inside other module (second pass of the query represented with purple color in the example pic attached):
ModNam values are different and MdCod matches between the entries then the most recent datestamp decides the single one to stay and others duplicates get deleted.
Please help and advise.
Example pic (updated):
Thank you all in advance.
I'm designing a database table and asking myself this question: How long should the firstname field be?
Does anyone have a list of reasonable lengths for the most common fields, such as first name, last name, and email address?
I just queried my database with millions of customers in the USA.
The maximum first name length was 46. I go with 50. (Of course, only 500 of those were over 25, and they were all cases where data imports resulted in extra junk winding up in that field.)
Last name was similar to first name.
Email addresses maxed out at 62
characters. Most of the longer ones
were actually lists of email
addresses separated by semicolons.
Street address maxes out at 95
characters. The long ones were all
valid.
Max city length was 35.
This should be a decent statistical spread for people in the US. If you have localization to consider, the numbers could vary significantly.
UK Government Data Standards Catalogue details the UK standards for this kind of thing.
It suggests 35 characters for each of Given Name and Family Name, or 70 characters for a single field to hold the Full Name, and 255 characters for an email address. Amongst other things..
W3C's recommendation:
If designing a form or database that will accept names from people
with a variety of backgrounds, you should ask yourself whether you
really need to have separate fields for given name and family name.
… Bear in mind that names in some cultures can be quite a lot longer
than your own. … Avoid limiting the field size for names in your
database. In particular, do not assume that a four-character
Japanese name in UTF-8 will fit in four bytes – you are likely to
actually need 12.
https://www.w3.org/International/questions/qa-personal-names
For database fields, VARCHAR(255) is a safe default choice, unless you can actually come up with a good reason to use something else. For typical web applications, performance won't be a problem. Don't prematurely optimize.
Some almost-certainly correct column lengths
Min Max
Hostname 1 255
Domain Name 4 253
Email Address 7 254
Email Address [1] 3 254
Telephone Number 10 15
Telephone Number [2] 3 26
HTTP(S) URL w domain name 11 2083
URL [3] 6 2083
Postal Code [4] 2 11
IP Address (incl ipv6) 7 45
Longitude numeric 9,6
Latitude numeric 8,6
Money[5] numeric 19,4
[1] Allow local domains or TLD-only domains
[2] Allow short numbers like 911 and extensions like 16045551212x12345
[3] Allow local domains, tv:// scheme
[4] http://en.wikipedia.org/wiki/List_of_postal_codes. Use max 12 if storing dash or space
[5] http://stackoverflow.com/questions/224462/storing-money-in-a-decimal-column-what-precision-and-scale
A long rant on personal names
A personal name is either a Polynym (a name with multiple sortable components), a Mononym (a name with only one component), or a Pictonym (a name represented by a picture - this exists due to people like Prince).
A person can have multiple names, playing roles, such as LEGAL, MARITAL, MAIDEN, PREFERRED, SOBRIQUET, PSEUDONYM, etc. You might have business rules, such as "a person can only have one legal name at a time, but multiple pseudonyms at a time".
Some examples:
names: [
{
type:"POLYNYM",
role:"LEGAL",
given:"George",
middle:"Herman",
moniker:"Babe",
surname:"Ruth",
generation:"JUNIOR"
},
{
type:"MONONYM",
role:"SOBRIQUET",
mononym:"The Bambino" /* mononyms can be more than one word, but only one component */
},
{
type:"MONONYM",
role:"SOBRIQUET",
mononym:"The Sultan of Swat"
}
]
or
names: [
{
type:"POLYNYM",
role:"PREFERRED",
given:"Malcolm",
surname:"X"
},
{
type:"POLYNYM",
role:"BIRTH",
given:"Malcolm",
surname:"Little"
},
{
type:"POLYNYM",
role:"LEGAL",
given:"Malik",
surname:"El-Shabazz"
}
]
or
names:[
{
type:"POLYNYM",
role:"LEGAL",
given:"Prince",
middle:"Rogers",
surname:"Nelson"
},
{
type:"MONONYM",
role:"SOBRIQUET",
mononym:"Prince"
},
{
type:"PICTONYM",
role:"LEGAL",
url:"http://upload.wikimedia.org/wikipedia/en/thumb/a/af/Prince_logo.svg/130px-Prince_logo.svg.png"
}
]
or
names:[
{
type:"POLYNYM",
role:"LEGAL",
given:"Juan Pablo",
surname:"Fernández de Calderón",
secondarySurname:"García-Iglesias" /* hispanic people often have two surnames. it can be impolite to use the wrong one. Portuguese and Spaniards differ as to which surname is important */
}
]
Given names, middle names, surnames can be multiple words such as "Billy Bob" Thornton, or Ralph "Vaughn Williams".
I would say to err on the high side. Since you'll probably be using varchar, any extra space you allow won't actually use up any extra space unless somebody needs it. I would say for names (first or last), go at least 50 chars, and for email address, make it at least 128. There are some really long email addresses out there.
Another thing I like to do is go to Lipsum.com and ask it to generate some text. That way you can get a good idea of just what 100 bytes looks like.
I pretty much always use a power of 2 unless there is a good reason not to, such as a customer facing interface where some other number has special meaning to the customer.
If you stick to powers of 2 it keeps you within a limited set of common sizes, which itself is a good thing, and it makes it easier to guess the size of unknown objects you may encounter. I see a fair number of other people doing this, and there is something aesthetically pleasing about it. It generally gives me a good feeling when I see this, it means the designer was thinking like an engineer or mathematician. Though I'd probably be concerned if only prime numbers were used. :)
These might be useful to someone;
youtube max channel length = 20
facebook max name length = 50
twitter max handle length = 15
email max length = 255
http://www.interoadvisory.com/2015/08/6-areas-inside-of-linkedin-with-character-limits/
I wanted to find the same and the UK Government Data Standards mentioned in the accepted answer sounded ideal. However none of these seemed to exist any more - after an extended search I found it in an archive here: http://webarchive.nationalarchives.gov.uk/+/http://www.cabinetoffice.gov.uk/govtalk/schemasstandards/e-gif/datastandards.aspx. Need to download the zip, extract it and then open default.htm in the html folder.
+------------+---------------+---------------------------------+
| Field | Length (Char) | Description |
+------------+---------------+---------------------------------+
|firstname | 35 | |
|lastname | 35 | |
|email | 255 | |
|url | 60+ | According to server and browser |
|city | 45 | |
|address | 90 | |
+------------+---------------+---------------------------------+
Edit: Added some spacing
Just looking though my email archives, there are a number of pretty long "first" names (of course what is meant by first is variable by culture). One example is Krishnamurthy - which is 13 letters long. A good guess might be 20 to 25 letters based on this. Email should be much longer since you might have firstname.lastname#somedomain.com. Also, gmail and some other mail programs allow you to use firstname.lastname+sometag#somedomain.com where "sometag" is anything you want to put there so that you can use it to sort incoming emails. I frequently run into web forms that don't allow me to put in my full email address without considering any tags. So, if you need a fixed email field maybe something like 25.25+15#20.3 in characters for a total of 90 characters (if I did my math right!).
I usually go with:
Firstname: 30 chars
Lastname: 30 chars
Email: 50 chars
Address: 200 chars
If I am concerned about long fields for the names, I might sometimes go with 50 for the name fields too, since storage space is rarely an issue these days.
If you need to consider localisation (for those of us outside the US!) and it's possible in your environment, I'd suggest:
Define data types for each component of the name - NOTE: some cultures have more than two names! Then have a type for the full name,
Then localisation becomes simple (as far as names are concerned).
The same applies to addresses, BTW - different formats!
it is varchar right? So it then doesn't matter if you use 50 or 25, better be safe and use 50, that said I believe the longest I have seen is about 19 or so. Last names are longer