Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

row generation-crisis

Status
Not open for further replies.

sydev

Programmer
Jun 8, 2004
3
US
hi all

Thank you for the help with my earlier query about refrential integrity. I am back again with another one.

I have a situation here where we need to generate a table in output which will have information about the date. I need to design a job in such a way that whenever it runs the first column in the output table will store the system date for that day and the some other related information which can be generated from the date. and the next rows will have a date which will be one month prior to the system....the table must have 120 rows...that is starting from the system date to 10 yrs backwards information.

I want to know that if we have no input file information and an output file required as above how do we start? I can think of writing routines for the related column information and jumping from one row to another....but then how define the input file?

Please help! need this information as soon as possible.
thank you
sydev
 
Hi,

As all of the information that you need in your output file can be determined from the system date, you wont need to define an input file, you could just write a subroutine that does a set of calculations to give you each row that you need and then write the results to a sequential output file. Your starting point for your date information would be with the Date() function, and then you would just need to figure out how to transform your date values.

I imagine your routine code would be quite simple, you would just need something structured like the following (please note, this is not syntactically correct, its just some idea of the logic you would need):
[tt]
systemdate = Date()
delim="|"
outputrows=120
currentrow=1
outputfile=<output file path and name>

open outputfile

while currentrow <= outputrows
col1 = some calculation based on systemdate
col2 = some other claculation based on systemdate
....etc

outputrec=col1:delim:col2:delim:col3.......
write outputrec to output file

currentrow=currentrow+1
systemdate=systemdate - 1 month
endwhile

close outputfile[/tt]

Of course, you'd still need a job to actually run the subroutine, even if it only uses dummy files and doesnt actually do any processing.

Alternatively (this works in theory) you could create a job that uses a dummy input file, and then uses a transformer stage and stage variables to do your date calculations and to only write 120 output records

I hope this is something like what you need.

Cheers
J
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top