Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

help needed - System Date formatting TACL

619 views
Skip to first unread message

Sathish Kumar

unread,
Jan 28, 2014, 2:05:53 AM1/28/14
to

Dear all

Am trying to use the system date to move the system files logged in the format N140128 (YY MM DD)
-----------------------------
TACL

[#push date yyyy mm dd ]
#setmany yyyy mm dd, [#contime [#timestamp]]


output is below

2014128 (yyyy mm dd)
--------------------------
in this case the issue is the month which is 1 but i want 01 . it will be same case for the dates (1to9)

how can i resolve this.


Regards

Keith Dick

unread,
Jan 28, 2014, 2:54:17 AM1/28/14
to
I believe that if you include the following routine in your TACL program:

[#def zero_pad routine |body|
[#frame]
[#push num]
[#case [#argument/value num/ number]
|1| [#set num [#compute [num] + 100]]
[#chardel num 1 for 1]
[#result [num]]
|otherwise| [#output no argument given]
]
[#unframe]
[#return]
]

Then use it like this:

[#push date yyyy mm dd ]
[#setmany yyyy mm dd, [#contime [#timestamp]]]
[#set mm [zero_pad [mm]]]
[#set dd [zero_pad [dd]]]

Then [yyyy][mm][dd] will give you the string that you want.

I don't have time to test the code, so there might be a typo or two, or a small error in the logic, but I'm pretty sure the technique of adding 100, then discarding the first character of the result, works. I'm sure I have used that, or some very similar, technique in TACL code myself sometime in the dim, distant past.

Tone

unread,
Jan 28, 2014, 3:10:44 AM1/28/14
to
I usually use :

[#if [mm] < 10 |then| #set mm 0[mm]]
[#if [dd] < 10 |then| #set dd 0[dd]]

Sathish Kumar

unread,
Jan 28, 2014, 3:47:34 AM1/28/14
to
Thank you Keith

Sathish Kumar

unread,
Jan 28, 2014, 3:47:50 AM1/28/14
to
Thank you Tone :)

Keith Dick

unread,
Jan 28, 2014, 4:18:43 AM1/28/14
to
That is a simpler solution that is good for this case.

The approach I showed is simpler when you have to pad with zeros to a longer length, but there probably is no need to use it for padding to just two digits. I just didn't think much about it and applied the general solution.

kumar.pra...@gmail.com

unread,
Dec 13, 2017, 1:43:11 PM12/13/17
to
Hi,
I am trying to previous date in yy mm DD format . Current date is OK but how can I found previous date .
Plz help..

kumar.pra...@gmail.com

unread,
Dec 13, 2017, 1:50:20 PM12/13/17
to
Hi, that is good . Can u please share me how can get previous date in yy mm DD format . I need to automatically report generation in batchcom.plz share .....

JShepherd

unread,
Dec 13, 2017, 2:14:43 PM12/13/17
to
In article <19138c53-118d-487d...@googlegroups.com>,
kumar.pra...@gmail.com says...
>
>Hi, that is good . Can u please share me how can get previous
>date in yy mm DD f>ormat.
>I need to automatically report generation in batchcom.plz share .....


#frame
#push _jts
#push _julianday
#push _yyyy
#push _mm
#push _dd

== juliantime in local time
#setmany _ _jts, [#converttimestamp [#juliantimestamp] 0]
== julian day number
#setmany _julianday, [#interprettimestamp [_jts] ]
== today yyyy mm dd
#setmany _yyyy _mm _dd, [#interpretjuliandayno [_julianday] ]
#output [_yyyy]-[_mm]-[_dd]

== previous day yyyy mm dd
#setmany _ _jts, [#converttimestamp [#juliantimestamp] 0]
#setmany _julianday, [#interprettimestamp [_jts] ]
#set _julianday [#compute [_julianday] - 1]
#setmany _yyyy _mm _dd, [#interpretjuliandayno [_julianday] ]
#output [_yyyy]-[_mm]-[_dd]

== 30 days ago
#setmany _ _jts, [#converttimestamp [#juliantimestamp] 0]
#setmany _julianday, [#interprettimestamp [_jts] ]
#set _julianday [#compute [_julianday] - 30]
#setmany _yyyy _mm _dd, [#interpretjuliandayno [_julianday] ]
#output [_yyyy]-[_mm]-[_dd]

#unframe




Keith Dick

unread,
Dec 13, 2017, 2:22:05 PM12/13/17
to
Use #COMPUTETIMESTAMP to construct a Julian timestamp from your given yy mm dd values. Fill in 0 for the hour, minutes, seconds, and fractional second parts. If your yy is a two-digit year, you'll have to figure out which century it is in to get a four-digit year. The Julian timestamp you get will be for midnight of the given date.

Then subtract 24*60*60*1000000 from that value. That is the number of microseconds in one day. That gives the tiemstamp of midnight the day before the given date.

Then use #INTERPRETTIMESTAMP to get the year, month, day, hour, minute, second, and fractional second for that adjusted timestamp. Discard all but the year, month, and day, and you have the previous date you wanted.

kumar.pra...@gmail.com

unread,
Dec 15, 2017, 8:39:17 PM12/15/17
to
Thanks jshepherd🙂

kumar.pra...@gmail.com

unread,
Dec 15, 2017, 8:40:05 PM12/15/17
to
Thanks Keith.,😉

kumar.pra...@gmail.com

unread,
Sep 27, 2018, 4:15:12 AM9/27/18
to
Hi,

I need some help , can I change the user id for batchcom job? If yes then what will be command

wbreidbach

unread,
Sep 27, 2018, 9:55:47 AM9/27/18
to
Am Donnerstag, 27. September 2018 10:15:12 UTC+2 schrieb kumar.pra...@gmail.com:
> Hi,
>
> I need some help , can I change the user id for batchcom job? If yes then what will be command

I had the same problem a while ago, for all that I know it is not possible to change the user, the only chance is deleting the job and submitting with the correct user.

Keith Dick

unread,
Sep 27, 2018, 10:15:43 AM9/27/18
to
kumar.pra...@gmail.com wrote:
> Hi,
>
> I need some help , can I change the user id for batchcom job? If yes then what will be command

I do not know much about NETBATCH, but I looked in the manual a bit, and it appears that the userid of a job is only determined by the current user at the time the job is submitted. There is a command named CHANGEUSER that can be used within BATCHCOM to change the current user, but you must know the user's password to use CHANGEUSER. If you do use CHANGEUSER before submitting a job, the job is submitted under the new current user's userid, since all subsequent BATCHCOM commands will be performed as that new user.

ATTACHMENT-SETs have a userid associated with them, but that appears to be used to control access to the ATTACHMENT-SETs, not the userid of the jobs.

There might be a way to change the userid used when a job is submitted, or a way to alter the userid of a job that has already been submitted, but if so, that capability is pretty well hidden by the manual. I imagine that the ability to change the userid of a job was not included in NETBATCH.

tandem

unread,
Oct 2, 2018, 9:42:11 PM10/2/18
to
Use #charcount , if charcount is = 1 then append 0 to it.

kumar.pra...@gmail.com

unread,
Jul 23, 2019, 1:57:57 AM7/23/19
to
Hi i need some help . How can i extrect binary data through enform.

Keith Dick

unread,
Jul 23, 2019, 2:15:41 PM7/23/19
to
kumar.pra...@gmail.com wrote:
> Hi i need some help . How can i extrect binary data through enform.

That is a very general question, so I cannot give a very specific answer, but I will say a few things that may help get you started.

The FIND command in Enform can be used to create a new data file from the data you extracted (as opposed to producing a printed report). If I remember correctly, FIND can produce only unstructured files, so you probably would find that after creating the file using ENFORM FIND, you would want to use FUP LOAD to load the data from the unstructured file produced by FIND into a key-sequenced file, which you would then use for further work.

Randall

unread,
Jul 23, 2019, 3:19:07 PM7/23/19
to
On Tuesday, July 23, 2019 at 1:57:57 AM UTC-4, kumar.pr...@gmail.com wrote:
> Hi i need some help . How can i extrect binary data through enform.

It depends what you want to do with the binary data. If you want to look at it in printable ASCII, then you have to define a DDL structure and dictionary describing the records you want to look at.

If you want to pull the data in binary form and stick it in another file, I would use a program rather than ENFORM. I do not think ENFORM can handle NUL values.

Keith Dick

unread,
Jul 24, 2019, 12:57:49 AM7/24/19
to
Randall, I'm not sure what you are thinking about when you say you think Enform cannot handle NUL values. Enform works only with Enscribe files, which don't actually have null values in the sense that SQL does. If by NUL values, you mean a byte of a field that has all of its bits set to 0, when using the FIND command, Enform would not have a problem with such values, since FIND is not attempting to format the data for display, just moving it to an output record.

Extracting data from a file and putting it into another file is exactly the purpose of the FIND command, so if the input file is one which can be described properly using DDL in a form that Enform can handle, Enform FIND should be a good way to solve the problem.

But we don't really know what Kumar is trying to do, and the words he chose to use for his question might be misleading both of us accidently.

Randall

unread,
Jul 24, 2019, 3:08:28 PM7/24/19
to
What I was meaning was using ENFORM to output binary unprintable data in raw form is not a good plan using ENFORM. I agree that we may not really be following the request.

kumar.pra...@gmail.com

unread,
Aug 2, 2019, 2:18:00 PM8/2/19
to
Thankd keith,

I m trying to enform find but not able to open file with existing DDL. Is any need to do changes in dictionary? Actually I want to extract the data through enform. Currently it is null value.

Randall

unread,
Aug 2, 2019, 3:18:25 PM8/2/19
to
On Friday, August 2, 2019 at 2:18:00 PM UTC-4, kumar.pr...@gmail.com wrote:
> Thankd keith,
>
> I m trying to enform find but not able to open file with existing DDL. Is any need to do changes in dictionary? Actually I want to extract the data through enform. Currently it is null value.

Assuming you know the structure of the records, you might want to create a new DDL dictionary with the record structure in it, and use that in ENFORM. Use the NULL attribute in your DDL to help ENFORM be happy. Have a look at the DDL Reference Manual for details.

Keith Dick

unread,
Aug 2, 2019, 8:07:43 PM8/2/19
to
kumar.pra...@gmail.com wrote:
> Thankd keith,
>
> I m trying to enform find but not able to open file with existing DDL. Is any need to do changes in dictionary? Actually I want to extract the data through enform. Currently it is null value.

You have to explain more about what you are trying to do and what problems seem to be preventing you from accomplishing it. I'm sure you don't want to write a book about your problem, so keeping your posts short is understandable, but your posts are too short. There is an old saying that to ask a good question, you already have to know most of the answer, and that principle might be part of what is making your questions not be very good.

I'll try to help by listing a few questions that your post raises. Try to answer these questions in your next post, and we should be able to help you with the problem.

1. What is the "existing DDL" used for?
2. What were the ENFORM commands you attempted to run, and what errors did you get from them?
Show the FULL EXACT TEXT of the error messages, if possible.
3. What led you to ask whether there was "any need to do changes in dictionary?" ?
4. When you said "Currently it is null value", what do you mean in a bit more detail?

If the DDL statements that describe the file from which you are trying to extract and the file into which you are trying to put the extracted data are not very long, it might be helpful to include them in your answer. But if your employer is sensitive about revealing such information, don't violate any rules. Also, don't post many hundreds of lines of DDL.

Using FIND to extract data is not much different than using LIST to make a report. The main difference is the output is sent to a file described by the DDL record that you name as the output-record-name in the FIND statement. Also, the features of the LIST statement that deal with formatting the data values for printing a report do not apply to the FIND statement. So if you know how to use a LIST statement to print a report that shows the data you want to extract (using the default formatting), changing that to a FIND command is pretty simple.
0 new messages