File match nomatch - mainframe

I have two files say F1 and F2 (both LRECL=37). If F1 and F2 are identical then output file should be empty and if they aren't identical then all records of F1 should be copied in output file. Is there any way this can be achieved thru JCL utility.

The expected result could be achieved in 3 jobsteps.
In the first jobstep, delete and define the output dataset using IEFBR14 utility.
In the second jobstep, compare the datasets F1 & F2 using IEBCOMPR utility. IEBCOMPR returns a code of 00 when the comparison is successful & 08 for an unequal comparison.
In the third jobstep, use the return code from the second jobstep to decide whether to run IEBGENER utility to copy ALL records of F1 dataset.
Hope this helps, please let me know if you've got an alternative that works efficiently.

Related

Excel convert multiple columns to dataset based on unique timestamp

I want to convert(Formula or way to do it) excel from one output to another for google maps csv upload to plot data on maps.
Example:
Original CSV:
Expected output for mymaps API:
Also note that this coordinates are not constant and changing across the city or state.
Attempt 1) Manual but dataset is too large
Attempt 2) Text to Column but that only supports via delimiters
F2 =UNIQUE($B$2:$B$20)
G2 =FILTER($C$2:$C$20;($B$2:$B$20=$F2)*($A$2:$A$20=G$1))
H2 =FILTER($C$2:$C$20;($B$2:$B$20=$F2)*($A$2:$A$20=H$1))
With O365 you can try the following in E1 and you can get the entire result including the header:
=LET(id, A2:A5, time, B2:B5, str, C2:C5, idUx, SORT(UNIQUE(id)),
timeUx, UNIQUE(time),GET, LAMBDA(tt,ii, XLOOKUP(tt&"|"&ii, time&"|"&id, str)),
REDUCE(HSTACK("ref_time", TOROW(idUx)), timeUx, LAMBDA(ac,t,
VSTACK(ac, HSTACK(t, GET(t,INDEX(idUx,1)), GET(t, INDEX(idUx,2)))))))
Here is the output:
Check the following question on how to use REDUCE/VSTACK pattern to generate each row: how to transform a table in Excel from vertical to horizontal but with different length. We use GET user LAMBDA function to avoid repeating the same calculation with different inputs (tt,ii). Just update the input range names (id, time, str) for your real problem. Added "|" to concatenate the search for more than one value, to avoid any false positive. Check #JvdV answer for more detail and comments. It can be avoided using MMULT, but it produces a more verbose formula. Due to the nature of your data, I don't think it is necessary, using a delimiter will be enough.

IF, AND and OR statement

I have an Excel query around an IF, AND and OR statement. I have spreadsheet based around city center stores being open when they are not supposed to be.
I have shown a snippet of the spreadsheet and in plain English I need to do the following:
IF E2 is "Open" AND F2 is "YES" then status should read "Normal"
IF E2 is "Open" AND F2 is "NO" then status should read "Warning, this store should be open"
IF E2 is "Closed" AND F2 is "YES" then status should read "Warning, this store should not be open"
I have had a go at it and have come up with 2 AND statements (Shown below) which work independently. I have been reading up about nested statements and it looks like this is what I need to do here, however I just can`t get my head around how I do actually stitch all of it together in to 1 statement.
=IF(AND(E2="Open",H2="NO"),"Warning, this store should be open","Normal")
=IF(AND(E2="Closed",H2="YES"),"Warning, this store should not be open","Normal")
You've mentioned using AND in your formula, but I think this is easily achieved with nested IFs:
=IF(E2="Open",IF(F2="YES","Normal","Warning, this store should be open"),IF(F2="YES","Warning, this store should not be open",""))
How to visualise what the above statement does:
E2 F2 Output
Open YES Normal
Open (anything else) Warning, this store should be open
(anything else) YES Warning, this store should not be open
(anything else) (anything else) (empty string)
It might be that you want other behaviour dependent upon other values of E2 and F2, but given your requirement the above will work.

REF Error when referencing power query table

guys,
Making great progress learning power query via StackOverflow! Let me describe my problem and the steps I've taken thus far:
So far I've followed guides on how to combine multiple files via a function and its actually worked great so far. I get data from a folder where all my files are, they are combined, "cleaned" to show only the columns I want, and then loaded into excel as a table... great!
Name | fCleanLogger.Temp (F)
------------ | --------
Logger A.txt | 78
Logger A.txt | 79
Logger A.txt | 57
Logger B.txt | 66
Logger B.txt | 90
Logger B.txt | 48
Logger B.txt | 44
The trouble starts when I want to reference that table for use in my "summary" sheet.
Example: I have 10 files. I want to get the max temperature value of each and every one of those files... but all those files are now combined. So I have to do an INDEX MATCH formula...
=INDEX(MAX(Excel_LogFiles[fCleanLogger.Temp (F)]), MATCH("Logger A.txt", Excel_LogFiles[Name], 0))
=INDEX(MAX(Excel_LogFiles[fCleanLogger.Temp (F)]), MATCH("Logger B.txt", Excel_LogFiles[Name], 0))
The strange thing is, it works perfectly when I use the formula for matching "Logger A.txt.". But then every other file name gives a #REF error.
Anybody have any suggestions? Very stumped on this one and don't know where to look for help.
Thanks so much in advance!
Index takes a range as the first argument. You are feeding it a Max statement instead. The first formula only returns a result because the Match returns a 1 and the first argument of the Index has one number as the result. The second formula fails because the Max still only returns one number (i.e. 90), but the Match now returns a 4 and there is only one value in the index range, i.e. 90).
If you have an Office 365 subscription, you can use the Maxifs function
=MAXIFS(Excel_LogFiles[fCleanLogger.Temp (F)],Excel_LogFiles[Name],E3)
If you run another version, you can use this array formula, which must be confirmed with Ctrl-Shift-Enter
=MAX(IF(Excel_LogFiles[Name]=E6,Excel_LogFiles[fCleanLogger.Temp (F)]))
Power Query has nothing to do with this, by the way. It's just Excel.

Python: how to open a file and loop through word for word and compare to a list

I have a file that is all strings and I want to loop through the file and check its contents against another file. Both files are too big to place in the code so I have to open each file with open method and then turn each into a loop that iterates over the file word for word (in each file) and compare every word for every word in other file. Any ideas how to do this?
If the files are both sorted, or if you can produce sorted versions of the files, then this is relatively easy. Your simplest approach (conceptually speaking) would be to take one word from file A, call it a, and then read a word from file B, calling it b. Either b is alphabetically prior to a, or it is after a, or they are the same. If they are the same, add the word to a list you're maintaining. If b is prior to a, read b from file B until b >= a. If equal, collect that word. If a < b, obviously, read a from A until a >= b, and collect if equal.
Since file size is a problem, you might need to write your collected words out to a results file to avoid running out of memory. I'll let you worry about that detail.
If they are not sorted and you can't sort them, then it's a harder problem. The naive approach would be to take a word from A, and then scan through B looking for that word. Since you say the files are large, this is not an attractive option. You could probably do better than this by reading in chunks from A and B and working with set intersections, but this is a little more complex.
Putting it as simply as I can, I would read in a reasonably-sized chunks of file A, and convert it to a set of words, call that a1. I would then read similarly-sized chunks of B as sets b1, b2, ... bn. The union of the intersections of (a1, b1), (a1, b2), ..., (a1, bn) is the set of words appearing in a1 and B. Then repeat for chunk a2, a3, ... an.
I hope this makes sense. If you haven't played with sets, it might not, but then I guess there's a cool thing for you to learn about.
I found the answer. There is a pointer when reading files . The problem is that when using a nested loop it doesn't redirect back to the next statement in the outer loop for Python.

How to shuffle multiple lines <tag> </tag> items in a text files or excel?

I have been searching for hours and haven't found a solution to this.
I have a selection I want to randomize but it's separated into multiple lines.
I can find the solution no problem for a single line randomiser but I'm stumped on this one.
Thanks for looking
This is what I have presently
1a
1b
1c
1d
2a
2b
2c
2d
3a
3b
3c
3d
I would like to randomize based on the number keeping the order of the letter the same
Referring to the notepad++ tag:
Here you can find a script to randomize the order of all or the selected lines.
https://github.com/ethanpil/npp-randomizelines
It requires the Python Script plugin which is easily installed via the plugin manager.
First check out this tutorial about using RAND() to generate random numbers which you can then sort by.
If you want to keep the "a, b, c, d" sequence the same, but shuffle the number component, I would split this data into two columns. Add a third column which will be for your random numbers. Finally, sort the numerical column according to the generated random values using VLOOKUP(). In other words, leave the letter column as-is, creating a shuffled number column.
Finally, combine the numeric and letter columns with a fourth column using CONCATENATE() and remove the split columns and random numbers.

Resources