Free Format RPG ILE Alternatives to the TIME Opcode

Time me

Here’s one of the free format BIFs I can never remember as far as syntax is concerned. Maybe if I keep it here I will be able to find it again :). I copied some of this from http://www.bmeyers.net/faqs/frequently-asked-questions/41-free-format-alternatives-to-time (the Q&A part).

Q. In fixed format RPG IV, I used the TIME operation code to get the current date and time; but TIME is not supported by free format. You mentioned that the %DATE, %TIME, and %TIMESTAMP functions can replace TIME, but I’m not sure how to use them for this purpose.

In my programs, I create a data structure like this:

D                 DS
D Dtime                         14  0
D  Wdate                         8  0 Overlay(Dtime)
D  Wtime                         6  0 Overlay(Dtime:*Next)

I’ve been using TIME to assign a value to Dtime, then I use Wtime and Wdate to assign values to work fields. How can I do this in free format?

A. If you do not specify a value for the %DATE, %TIME, and %TIMESTAMP functions they will return the current date, time, or timestamp. Then, it’s a simple matter to convert that value to a number in your data structure. Here’s one way to do it:

D                 DS
D Dtime                         14  0
D  Wdate                         8  0 Overlay(Dtime)
D  Wtime                         6  0 Overlay(Dtime:*Next)  

  // V5R3:
     Wtime = %Dec(%Time():*ISO);
     Wdate = %Dec(%Date():*ISO);             

  // V5R2:
     Wtime = %Dec(%Char(%Time():*ISO0):6:0); <= This is like TIME into a 6,0 numeric field
     Wdate = %Dec(%Char(%Date():*ISO0):8:0);

Or, if you make a small change to the data structure:

D                 DS
D Dtime                         20  0
D  Wdate                         8  0 Overlay(Dtime)
D  Wtime                         6  0 Overlay(Dtime:*Next)

  // V5R3:
     Dtime = %Dec(%Timestamp());

  // V5R2:
     Dtime = %Dec(%Char(%Timestamp():*ISO0):20:0);
Thanks to bmeyers.net
Here what I just did with it.
AORDERTIME = %dec(%char(%time():*ISO0):6:0); // 0 means no separator

Click here for reuse options!
Copyright 2012 WallyDay.com
Tags: , , , , , , , , , , , ,
Previous Post
Miscellany Politics

A Little Activism on the Court?

Next Post
Miscellany

Pimped My LinkedIn Profile!

Comments

    • NAruto
    • December 5, 2013

    I Want To Small Download NAruto Episodes Less Than 40 Mb Any Format Is Okay? But the episode download should not be in any way related to any site which asks money for full speed download like megaupload or rapidshare it should be completely free.Any format is okay low quality will also work but it should fit in my 17″ monitor and should not appear blurred

    View Comment
    1. I guess you can never gonna find episodes in that much space or if you are lucky enough to get that than your gonna hate it cause the pictures of that one would be the worst of them all so heres the most economical version called rmvb..download Naruto from this site(and the animes r in a range between 70-90 mb per file and its free)

      http://realitylapse.com/videos/naruto.php
      http://realitylapse.com/videos/naruto-shippuuden.php

      View Comment
    • Iamme
    • December 17, 2013

    Which Is The Best Online Website To Learn Data Structures Using C For Beginners? I have idea about C and data structures,but wen it comes to programming its difficult.please suggest me a good website to learn.I want sorting,linkedlist and searching techniques.

    View Comment
    • Hockeyfan
    • December 19, 2013

    What Topic(s) Should I Learn After I Have Studied Data Structures In Java? I took one class in Java at my local community college.I am learning data structures for Java on my own because the college didn’t offer the data structures class.Basically I know how to do applets and application programs for Java using SE.

    View Comment
      • Admin
      • December 19, 2013

      Learn classes in java

      View Comment
    • Anonymous!
    • January 13, 2014

    Where Can I Find Free Software To Format My External Hdd From NTSF To FAT32? I have a 100gb external HDD I would like to use with my PS3 and I can’t find a software to format the external HDD from NTSF to FAT32. I am running Windows 7 64 bit.

    View Comment
    1. You can several free convertors which can convert HDD from ntfs to fat32 and vice versa.
      you can download free convertors at:
      http://www.brothersoft.com/downloads/ntfs-to-fat32-converter.html

      View Comment
    • Msm
    • January 15, 2014

    Is There A Data Structure That Can Find&delete From The Middle In Constant Time? It can also be amortized O(1) time – that’s good enough for my purposes.

    The only thing I will be doing with this data structure will be repeatedly removing elements in a specific order until they’re all gone.

    View Comment
    1. Hi,

      The data structure which you should go for is Hash Map. Here is a c++ program demonstrating Hash Map find and delete operation.

      #include
      #include
      #include

      using namespace std;
      using namespace stdext;

      void print(hash_map hm){
      for(hash_map
      ::iterator hit = hm.begin(); hit != hm.end(); hit++){
      cout< first< <" "<second< months;
      months[“january”] = 31;
      months[“february”] = 28;
      months[“march”] = 31;
      months[“april”] = 30;
      months[“may”] = 31;
      months[“june”] = 30;
      months[“july”] = 31;
      months[“august”] = 31;
      months[“september”] = 30;
      months[“october”] = 31;
      months[“november”] = 30;
      months[“december”] = 31;
      print(months);
      // suppose you want to delete the entry for july
      // all you have to do is this
      hash_map
      ::iterator hit = months.find(“july”); // find unction
      months.erase(hit); // delete function
      cout<

      View Comment
    • Schambach
    • January 19, 2014

    Can Someone Tell Me How To Implement The Following Data Structures? I’m taking an undergraduate computer science course and I’m having a hard time understanding how to actually use the data structures were taught about in class. I would like to know especially how to implement heaps, binary trees and linked lists. Your help will be appreciated.

    P.S don’t tell me to do more research or look at wikipedia. Already done that. I would like a straightforward and simple explanation, kapish?

    View Comment
    1. Check out learninglover.com. Lots of examples of data structures there with explanations too.

      View Comment
    • Anonymous
    • January 22, 2014

    Can’t The Last Node Be Deleted Or Retrieved From An Ordinary List Data Structure? If Yes Why, No Why? Explain with eg. I was going thru my professor slides and I got this doubts. PLease help me. Is there any good discussion forum for data structures and algorithms. I can find some for prog. languages but not for Data structures and algorithms.

    View Comment
    1. U can make use of this link for Data Structure discussion forum…

      http://forum.algolist.net/data-structures-and-algorithms/?PHPSESSID=fe7cfd641dfe22b67f2fab0967ce89b4

      We can delete all the nodes if we want. Thats possible..
      If u use C programming for linked list,verify for loop iterations…

      View Comment
    • Chillinginchicago
    • January 23, 2014

    How Much Do People Charge To Put Together Your Resume For You? I’m graduating from college with a degree in organizational communication and was going to start re-doing my resume and getting ready to get a job and was wondering how much those services or people who put together your resume charge? Please don’t tell me there’s free resume format things online. I want advice on how to organize it and wording to use as opposed to just filling in a template.

    View Comment
    1. I used this resume writing service in my area, this is the email address, (resume.help50@yahoo.com) you should try them, it only cost me $35.00 and I got a great job from this new resume, I never thought about the format that they use but the turn around time was less then 24 hrs. I would have to say it was the best service I have ever used and it was worth every dime. Also they let me pay through paypal.

      View Comment
    • Harry F
    • February 20, 2014

    Need To Convert Mp4 To Mp3 Format (free)? Please I want to convert some mp4 files to mp3 ,so i can put them on my mp3 player,i Downloaded some videos”I only want to listen to them my mp3 doesn’t have a screen so i was trying to convert them, i tried many places but they would be demos and say “we can only convert the first 1:30 sec’s” or “this is a trail” so you see my problem please help me find a FREE and good conversion tool.

    View Comment
      • Admin
      • February 20, 2014

      Best one, the ONLY one is Format Factory. It is free and will convert from and to virtually all music, video, picture, and ROM device formats! It will even combine two videos, if you prefer!

      You can download it here: http://www.formatoz.com/

      Hope that helps!

      View Comment
    • Elijah Ruhanga
    • March 4, 2014

    Definition Of Data Structures?

    View Comment
    1. A data structure is a specialized format for organizing and storing data. General data structure types include the array, the file, the record, the table, the tree, and so on. Any data structure is designed to organize data to suit a specific purpose so that it can be accessed and worked with in appropriate ways. In computer programming, a data structure may be selected or designed to store data for the purpose of working on it with various algorithms.

      View Comment
    • Royd
    • April 6, 2014

    What Are Data Structures? I don’t understand the concept behind Data structures, what is all about? Why is it important we learn them. I also need a link where i can download a simplified ebook on It cos i couldn’t get a straight-forward explanation online. Pls HELP!!

    View Comment
    1. A data structure stores data. Knowing data structures is important because storing data efficiently is just as important as the data itself. Data structures is a critical computer science concept, although its ideas are more general than just programming.

      For instance, a library contains a lot of data (e.g. books). But a library wouldn’t be very useful if no one could find the book they wanted. So libraries have a system for organizing their books, usually based on the genre and/or the author’s last name. Similarly, choosing a good data structures in computer science is important so that the program can quickly and efficiently access and modify data.

      For instance, the file system on your computer uses an interesting data structure. On most hard drives, files are scattered throughout the disk, and the entire contents of a file may not even be in the same place — thus, sometimes it’s necessary to defragment the hard drive to speed things up. The design of such a file system is an example of a data structure.

      View Comment
    • O_o
    • May 7, 2014

    Is It Free To Format Your Computer? Is it free to format the Drive C on a Windows Vista computer?

    View Comment
    1. You can format your computer absolutely free...For that you only have to know the right procedure to format your PC.

      View Comment
    • Thedude8543
    • May 20, 2014

    Free Format Changers? I need to burn a dvd of the lorax i have it on my computer but its in .flv format i need it so roxio can burn it to a dvd wat is a free video format changer??

    View Comment
    1. You must convert them into mpeg format.
      You can use FLV to Video Converter. With this tool, you can download, play, and convert flv vids to many video and audio formats. I’m using it for a long time and it works very well.
      You can search “flvsoft” on google.com for more info.

      View Comment
    • Clint Butler
    • May 30, 2014

    How To Format Meta Tags For Free Website Traffic? I am looking for the general meta tag formats that a site should have to increase optimization for the purpose of ensuring a high ranking in the search engines thus getting free website traffic.

    View Comment
    1. You can get the Free meta Tag for getting the Traffic to Your website at here
      http://sitetrafficsource.com/tools/free-meta-tag-generator-seo-tool/ but i would not recommend that because they are not helps to increase the Traffic..If it also help to increase fast …in the same side it decrease the rank in search engine,…So you need to get some safe and paid one…You can Follow the suggestion below to get the Traffic for Your website

      There are many to get the Traffic for Your website…
      You can Submit answers,Forums,Blogs to get Visitors and Get ranking in Google and Yahoo,etc….You can submit Links for your site in Related Content..Not in Unrelated place ..It may get wrong name among user for your site…..
      You can also submit Directories….and also like Dmoz and Yahoo….You can also Implement some SEO tools to get that Ranking for Your site,You can get the Traffic Blazer(Search Engine Visibility service at low cost here
      http://www.tucktail.com/tt/traffic-blazer/ and get the Traffic for Your site,,,that is also one good way…

      View Comment
Comments are closed.
%d bloggers like this: