How to dynamically generate target files for a cycle? - salesforce

I have source file as follows:
ID Name
1 A
2 B
3 C
4 D
5 E
...so on.
Data should go to 3 target files:
I want first 3 records to be routed to first target file, next 3 to second target file and so on till 9th record.
After that, next 3 records (10th-12th) should be routed to 1st Target file again.
This should go on for n number of records.
There will be 3 Target Files, mapped multiple times.
How can this be achieved?

Create a port that will have target file name. Set the target to append to file. Use Transaction Control to start writing to next file.

For this to achieve my approach would be to use Mod of id\3. Below is how I would handle it in expression:
Variable port v_mod: MOD(ID,3)--- finds mod and its value would be 0,1,2 always
variable port group: IIF(ISNULL(group) OR group= 0 OR v_group=4,1,v_group)-- sets the variable port group to 1 at initialization or if group value increases by 3 i.e 4
Output port o_grp: group-- output port
v_group=IIF(v_mod=0,group+1,group)-- increase value of group which can be used in variable port group.
After this is performed o_grp output port can be used in router to divide the rows to multiple target based on value i.e. either 1,2,3

Related

What line changed in a PDSE member?

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.

How to create runtime variable for reading csv file header using Pandas

I have a csv file .It logs some data depending upon the test condition.
The header file of this csv file is like below
UTC Time(s) SVID-1 Constel-1 Status-1 Zij-1 SVID-2 Constel-2 Status-2
10102 1 G P 0 2 G P
Zij-2 SVID-3 Constel-3 Status-3 Zij-3 .......
0.3 3 G A --
.....
Apart from UTC Time column, other columns may increase or decrease depending
upon test condition or number of satellites I use.
If any extra satellite introduces or reduces then corresponding Svid,Constel, Status,Zij will be present or will not be there.
I am interested to know whether is it possible to create runtime variable for each column without looking into csv file header.

Database PHPMYADMIn

I want to create a database with 5000 entries (coupons) and 6 columns for each entry. The first column entry is to be numbered from 1 to 5000. The second column in each entry is a unique 11 digit code. All other column entries are identical for every coupon.
If i create an entry in phpMyadmin, then copy it and change the first column entry to increment it by one for the new coupon, and add the new 11 digit code to the second column entry and save as new entry, it is faster than creating an entirely new entry from scratch, but it will still take ages to repeat this 5000 times.
I have each of the 5000 unique codes in a word file. Is there a way to duplicate one of my coupon code entries 5000 times incrementing the first column entry by 1 (ie from 1-5000), then uploading the 5000 unique 11 digit codes, and assign a unique 11 digit code to the second column of each of the 5000 entries?
Why not just turn your .word file into a .csv file and then upload it into your database using the "import" option? You could get all your coupons on the database,since I'm guessing you will be using them later on anyways?

gnuplot: How to store two date values from inside file in variable

Out of a power measurement device I get a csv file like this:
Position Date Time P(SUM) Unit
and the values look like this:
0 10/17/2015 18:10:11 0.214 kW
0 10/17/2015 18:10:13 0.211 kW
0 10/17/2015 18:10:15 0.413 kW
0 10/17/2015 18:10:17 0.522 kW
Now I want to use the first date and time in the file and the last one to be stored in a variable each so I can use it in the title.
So I have two questions:
How do I store a date value from a file in a variable?
How can I access the first and last one?
I use gnuplot 5.0 on windows.
You should use this old workaround, system independent; get the idea and modify if needed:
f(x,y)= ( y==0 ) ? ( first = x ) : (last= x)
plot "data.dat" us ($1):(f($4,$0))
The first line defines a function with an if on the second parameter ( test ? action_if_true : action_if_false ). It should be a value... but we perform an assignment.
With the second command you plot the file through that function... passing as second parameter the column 0 (the row number, that starts from 0). So with the first row of the file you store the current value in the variable first, and for all the other rows you will update the value of last.
Now you can try
print first , last
0.214 0.522
After you will be free to do your real graphic, to use the variables as you wnat; moreover you can use other tricks to avoid to see the fake plot and so on...
How to put in a single variable that format of date/time is another question... and yes, you can nest the if and eventually select the line you want.

Usage of sequence in SQL Server 2012

I have SQL Server 2012 and I want to know what's the usage of sequence. I Look for a sample to explain usage of sequence.
EDIT
I know create and use Sequence in database. I want to know what is practical scenario for use of Sequence.
CREATE SEQUENCE dbo.OrderIDs
AS INT
MINVALUE 1
NO MAXVALUE
START WITH 1;
SELECT NextOrderID = NEXT VALUE FOR dbo.OrderIDs
UNION ALL SELECT NEXT VALUE FOR dbo.OrderIDs
UNION ALL SELECT NEXT VALUE FOR dbo.OrderIDs;
Results:
NextOrderID
-----------
1
2
3
See here for original source and more examples. The page refers to SQL Server Denali which is the beta of SQL 2012 but the syntax is still the same.
One of the ways I leverage the SEQUENCE command is for reference numbers in an ASP/C# detailsview page (as an example). I use the detailsview to enter requests into a database and the SEQUENCE command serves as the request/ticket number for each request. I set the inital sequence command to start with a specific number and increment by 1 for each request.
If I present these requests in a gridview I make the SEQUENCE reference numbers appear but don't make them editable. Its great for a reference number when records are similar with other fields in the database. It's also perfect for customers when they have questions about a specific entry in a given database. This way I have a unique number per entry no matter if the rest of the information is identical or not.
Here's how I generally leverage the SEQUENCE command:
CREATE SEQUENCE blah.deblah
START WITH 1
INCREMENT BY 1
NO CYCLE
NO CACHE
In short, I start my sequence at #1 (you can choose any number you want to start with) and it counts upwards in increments of 1. I don't cycle the sequence numbers when they reach the system max number.

Resources