How to pass values from rexx to jcl - jcl

i've jcl which accepts date and pass value to rexx to get next date and previous date.
and then jcl prints that next and previous dates.
please tell how to take value back from rexx to jcl and use that values in jcl

If it's to print the date, then JCL doesn't actually do that. Rather JCL invokes a program that writes data that can be printed.
If it's printing of the dates, then that could be achieved using EXECIO.
If your requirement is to modify JCL AND that JCL is not the current JCL, then Rexx can be used to submit a modified job or jobs (system authority permitting). If I recall correctly you'd use INTRDR.

blvdeer kind of explained how JCL works above in the comment but you can start to work of something like this.
Use REXX to invoke its DATE (reference here - z/OS TSO/E REXX DATE) and put this into a variable to do whatever you want with it (in this case current and previous dates) and use EXECIO as per MikeT answer to write this to a dateset.
Later you can run a JCL to do whatever with this newly created dataset as an input.
Regards,
Jarek.

Related

including current date in printfile names

I am using a macro to obtain data from a website and save to a print file using the print function on the specific website page.
In the print window i can select "print to pdf" but do not know how to format the output filename to reflect the current date.
The macro will be run every month to save a snapshot of the website's data.
I have tried several suggestions from the forums but haven't found a solution that works.
Filename required is of the form "yyyymmdd_account_summary.pdf"
Using Kantu as the macro recorder in firefox 68 on fedora 29.
i tried setting the print file name to
$(date +"%y%m%d")_account_summary.pdf
but this only created a file named
$(date +"%y%m%d")_account_summary.pdf
no variables were substituted.
obviously i am doing something simple wrong but cannot see it.
Expected resulting filename
20190731_account_summary.pdf
actual name that is created
$(date +"%y%m%d")_account_summary.pdf which is clearly wrong
We are not very familiar with Kantu but I suggest we do it in three steps.
Step 1. Let your macro runs periodically to a fixed file name (/tmp/my_temp_file.pdf).
Step 2. Write a script (bash or python) to monitor the file modify/overwrite timestamp and whenever it detects changes, copy the file (/tmp/my_temp_file.pdf) into "yyyymmdd_account_summary.pdf"
Step 3. Make a cronjob that invoke the script periodically.

Talend - Extract FileName from tLogRow/tSort

I am new to Talend and just trying to work my way through it.
Problem Statement
I need to process a positional file, from a list of files. Need to identify the latest file first and then process only that file. I was able to identify the most updated file. And then I was able to create another flow which processes the positional file. The problem is combining these two flows so that I am able to identify the most recent file and have just that one processed.
Tried so far
Have been trying to extract the most recent file from a list within a directory. Iterated through all the files, retained their properties in a buffer. Post completion of this sub-task, read through the buffer, sorted with descending mime, extracted the top record and was able to print it using tLogRow.
All seems to be fine except I don't know how to use the filename now for next task.
I am certain this is very rudimentary but I'll be honest, I've been scourging the internet/help from quite some time now, with no success.
Any pointers would help.
The job flow is attached for your reference.
First of all, you can simplify your job by using tFileList's capabilities. It can sort files by their modified date:
Next, use tIterateToFlow to convert each iteration to a row:
(String)globalMap.get("tFileList_1_CURRENT_FILEPATH")
and tSampleRow with a range of "1", to get the most recent file.
Then store the result in a global variable. In the next subjob, just use that global variable as your filename in tFileInputPositional.

How to save some variable values in a file

I want at the end of my program to get the values stored at certain variables and append them to a file let's say "result". I am going to run it several times (for different parameters) at night and then check results in the morning.
Basically, I am looking for something similar to redirection in linux (>>) for matlab.
I am using the diary function to store the whole messages from my program and i want to keep those for verifying later.
But here what I want is just some specific values. So how to do it?
It does not necessary have to be in the same file. If I can get each result in a separate file, that is ok too.
You can use a combination of diary and any function which can append data to a text file, but you have to turn off diary before writing. A short example using save
f='example.txt'
diary(f);
for ix=1:10
disp(ix);
diary off %diary off to flush
save(f,'ix','-append','-ascii')
diary(f);
end
Instead of save you can also use fprntf or dlmwrite

Add to a value read into a JCL

I am working on writing a JCL which will read an option card containing a date. I need the date that is read in +1 and +2. Is there a way for me to do this in my JCL?
For example, my option card might contain: 20150923
I, for other pieces of my JCL, need: 20150924 and 20150925
Best here is to use REXX to either generate a job or have a written template that you modify and submit.
With REXX you would have to open the file/dataset that you obtain the 'option card' , save that to a variable and later on pass it to the edited JCL.
At the end You can submit the job or do it later manually.
Regards,
Jarek.
Here is a nice example. Bit of a long read but it's Using a batch REXX procedure to generate a unique output data set name

Running a Perl script within a Stata .do file

Is it possible to execute a Perl script within a Stata .do file?
I have a Stata .do file in which I make some manipulations to the data set and arrange it in a certain way. Then I have a Perl script in which I take one of the variables at this point, apply a Perl package to it, and make a transformation to one of the variables. In particular, I use Perl's NYSIIS function, resulting in a very short script. After this output is provided in Perl, I'd like to continue with some additional work in Stata.
Two alternatives that come to mind but that are less desirable are:
Write Stata code to do nysiis but I prefer to use Perl's built-in function.
outsheet and save the output from the Stata .do file as a .txt for Perl. Then do the Perl script separately to get another .txt. Then read in that .txt to Stata to a new .do file and resume.
Your approach number 2 is what I use to call other programs to operate on Stata data. As Nick says, Stata won't necessarily wait for your output, unless you ask it to. You first outsheet the text file, then call the Perl script from Stata using ! to run something on the command line. Finally, have Stata periodically check for the result file, using a while loop and the sleep command so Stata isn't constantly checking.
outsheet using "perl_input.txt"
!perl my_perl_script.pl
while (1) {
capture insheet using "perl_output.txt", clear
if _rc == 0 continue, break
sleep 10000
}
!rm perl_output.txt
Here, your formatted data is saved from Stata as perl_input.txt. Next, your Perl script is run from the command line, and using a while loop, Stata checks for the output every 10 seconds (sleep takes arguments in milliseconds). When it finds the output file, it breaks out of the while loop. The last line is a good idea so that when you re-use the code you don't run the risk of using the Perl output from the last run.
I think the main issue is that although you can use the shell to call up something else, Stata is not going to wait for the results.
Start with help shell to see what is possible, but your #2 does sound easiest.