×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Generating Additional Records in Hold File

Generating Additional Records in Hold File

Generating Additional Records in Hold File

(OP)
I have a file called YEARS containing unique years: 2002, 2003, 2004, ..., 2010. I would like to store the years in a hold file, with one exception. For the current year only (2004), I want to write 2 different records to the hold file: 'First half 2004', and 'Second half 2004'.

I looked into join and match, but neither seemed to do what I need.

Anybody know how to do this?

Thanks for your assistance!

RE: Generating Additional Records in Hold File

Sean,

if I understand correctly, you'll need something like this

DEFINE FILE YEARS
-* assuming the format is YY or numeric
NEW_YEAR/A15 = IF OLD_YEAR EQ '2004'
               THEN 'First Half ' |  EDIT(OLD_YEAR)
               ELSE EDIT(OLD_YEAR);
END

TABLE FILE YEARS
PRINT NEW_YEAR
BY OLD_YEAR NOPRINT
ON TABLE HOLD AS NEW_YEARS
END

RE: Generating Additional Records in Hold File

(OP)
Craigiep,

I need the hold file to look like this:
2002
2003
First half 2004
Second half 2004
2005
2006
...

So one of the records from the table (2004) needs to be split off into 2 different records, and all the others stay as they are.

Thanks,
Sean

RE: Generating Additional Records in Hold File

Sean,

sorry about that, I must have been sleeping.  

DEFINE FILE YEARS
-* assuming the format is YY or numeric
FIRST_YEAR/A15 = IF OLD_YEAR EQ '2004'
               THEN 'First Half 2004
               ELSE EDIT(OLD_YEAR);
SECOND_YEAR/A15 = IF OLD_YEAR EQ '2004'
               THEN 'Second Half 2004'
               ELSE EDIT(OLD_YEAR);
END

TABLE FILE YEARS
PRINT FIRST_YEAR
BY OLD_YEAR
ON TABLE HOLD AS NEW_YEARS
END

-* then append the second field to this file
FILEDEF NEW_YEARS DISK new_years.ftm (APPEND
-RUN

TABLE FILE YEARS
PRINT SECOND_YEAR
BY OLD_YEAR
WHERE OLD_YEAR EQ '2004'
ON TABLE HOLD AS NEW_YEARS
END
-*
-* you might want to sort the file now so that it's in order

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close