Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

2 input file ==> 2 output file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
theone1987

New User


Joined: 14 Sep 2009
Posts: 60
Location: Milan

PostPosted: Wed Mar 17, 2010 3:31 pm    Post subject: 2 input file ==> 2 output file
Reply with quote

hello everybody.
I need a hand.
I have two input files, with the same key and I have to create two output files.

all files (both input and output files) have the following characteristics:
Record format. . . : FB
Record length. . . : 290

the key is on three fields with the following characteristics:
Field 1: length 8 from position 14 (it is a field packed)
Field 2: length 10 from position 38 (it's a date)
Field 3: length 10 from position 58 (it's a date)

Input file 1
XXXXXXXX ...... ...... 2010-03-31 ..... 2010-03-31
XXXXXXXX ...... ...... 2010-03-31 ..... 2010-02-28
XXXXXXXX ...... ...... 2010-02-28 ..... 2010-02-28
XXXXXXXX ...... ...... 2010-01-31 ..... 2010-01-31
XXXXXXXX ...... ...... 2010-01-31 ..... 2009-12-31

Input file 2
XXXXXXXX ...... ...... 2010-03-31 ..... 2010-02-28
XXXXXXXX ...... ...... 2010-01-31 ..... 2010-01-31


Output file 1
XXXXXXXX ...... ...... 2010-02-28 ..... 2010-02-28
XXXXXXXX ...... ...... 2010-01-31 ..... 2009-12-31

Output file 2
XXXXXXXX ...... ...... 2010-03-31 ..... 2010-03-31
XXXXXXXX ...... ...... 2010-03-31 ..... 2010-02-28
XXXXXXXX ...... ...... 2010-01-31 ..... 2010-01-31

I hope is not complicated.

In the first output file i will have to put all records that do not exist in the input file 2 and with the date (the key field n ° 3) lower than a reference date that I define as a parameter (for example defines that the reference date is 2010-02-28).

In the second file I'll put all the records that exist in the input file 2 + all records with the date (the key field n ° 3) greater than the date defined by me.


I hope it is all clear
Back to top
View user's profile Send private message

Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Wed Mar 17, 2010 10:12 pm    Post subject:
Reply with quote

theone1987,

Is the combination of field1 + field2 + field 3 unique? or do you have duplicates in both files? It would be a good idea if you showed the displayable field1 (packed decimal field) values also
Back to top
View user's profile Send private message
theone1987

New User


Joined: 14 Sep 2009
Posts: 60
Location: Milan

PostPosted: Thu Mar 18, 2010 3:45 pm    Post subject:
Reply with quote

Skolusu wrote:
theone1987,

Is the combination of field1 + field2 + field 3 unique? or do you have duplicates in both files? It would be a good idea if you showed the displayable field1 (packed decimal field) values also



I did not understand what you mean, sorry
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Thu Mar 18, 2010 4:09 pm    Post subject:
Reply with quote

theone1987 wrote:
Skolusu wrote:
theone1987,

Is the combination of field1 + field2 + field 3 unique? or do you have duplicates in both files? It would be a good idea if you showed the displayable field1 (packed decimal field) values also



I did not understand what you mean, sorry


What kolusu wants to understand is can there be multiple occurrences of
same combination of f1 f2 and f3 is possible?
eg
Can your input file have data like below. similarly for second file.
Code:

Input file 1
XXXXXXXX ...... ...... 2010-03-31 ..... 2010-03-31
XXXXXXXX ...... ...... 2010-03-31 ..... 2010-03-31
Back to top
View user's profile Send private message
theone1987

New User


Joined: 14 Sep 2009
Posts: 60
Location: Milan

PostPosted: Thu Mar 18, 2010 4:13 pm    Post subject:
Reply with quote

Oh, ok...sorry...
no, a situation like that, it's impossible.
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Thu Mar 18, 2010 4:58 pm    Post subject:
Reply with quote

Quote:
In the second file I'll put all the records that exist in the input file 2 + all records with the date (the key field n ° 3) greater than the date defined by me.

what is date defined by me?

Can you explain this rule clearly.
Quote:

XXXXXXXX ...... ...... 2010-01-31 ..... 2010-01-31

reason for this record being in op2?
Back to top
View user's profile Send private message
theone1987

New User


Joined: 14 Sep 2009
Posts: 60
Location: Milan

PostPosted: Thu Mar 18, 2010 5:17 pm    Post subject:
Reply with quote

Sambhaji wrote:
Quote:
In the second file I'll put all the records that exist in the input file 2 + all records with the date (the key field n ° 3) greater than the date defined by me.

what is date defined by me?

Can you explain this rule clearly.
Quote:

XXXXXXXX ...... ...... 2010-01-31 ..... 2010-01-31

reason for this record being in op2?



I need to "clean" a table from a certain date. This date may not always be the same, but I decide the date from which to start "cleaning".
(Warning: I do not choose the date within the record
XXXXXXXX ...... ...... 2010-01-31 ..... 2010-01-31)

but the one that should be in the icetool.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri Mar 19, 2010 12:41 am    Post subject: Reply to: 2 input file ==> 2 output file
Reply with quote

thenone1987,

Well try this DFSORT JOB and let me know if it gives you the desired results


Code:

//STEP0100 EXEC PGM=SORT                                           
//SYSOUT   DD SYSOUT=*                                             
//SORTIN   DD *                                                     
//SORTOUT  DD DSN=&&HEADR,DISP=(,PASS),SPACE=(TRK,(1,0),RLSE)       
//SYSIN    DD *                                                     
  SORT FIELDS=COPY                                                 
  OUTFIL REMOVECC,BUILD=(290X),HEADER1=(3C'$')                     
//*                                                                 
//STEP0200 EXEC PGM=SORT                                           
//SYSOUT   DD SYSOUT=*                                             
//SORTIN   DD DSN=&&HEADR,DISP=SHR,VOL=REF=*.STEP0100.SORTOUT       
//         DD DSN=Your input FB 290 byte file2,DISP=SHR
//         DD DSN=&&HEADR,DISP=SHR,VOL=REF=*.STEP0100.SORTOUT       
//         DD DSN=Your input FB 290 byte file1,DISP=SHR
//ONLYF1   DD SYSOUT=*                                             
//OTHER    DD SYSOUT=*                                             
//SYSIN    DD *                                                     
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,3,CH,EQ,C'$$$'),PUSH=(291:ID=1))
  SORT FIELDS=(14,08,PD,A,                                         
               38,10,CH,A,                                         
               58,10,CH,A),EQUALS                                   
  SUM FIELDS=(291,1,ZD)                                             
                                                                   
  OUTFIL FNAMES=ONLYF1,BUILD=(1,290),                               
  INCLUDE=(291,1,ZD,EQ,1,AND,58,10,CH,LT,C'DATE COND')             
                                                                   
  OUTFIL FNAMES=OTHER,BUILD=(1,290),                               
  INCLUDE=(291,1,ZD,GT,2,AND,38,10,CH,GT,C'DATE COND',AND,         
           001,3,CH,NE,C'$$$')                                     
//*
Back to top
View user's profile Send private message
theone1987

New User


Joined: 14 Sep 2009
Posts: 60
Location: Milan

PostPosted: Fri Mar 19, 2010 1:10 pm    Post subject: Re: Reply to: 2 input file ==> 2 output file
Reply with quote

Skolusu wrote:
thenone1987,

Well try this DFSORT JOB and let me know if it gives you the desired results


the code give me this error

Code:

  INCLUDE=(291,1,ZD,GT,2,AND,38,10,CH,GT,C'2010-02-28,AND,
                  001,3,CH,NE,C'$$$')
                                        $
SYNTAX ERROR


also can you explain me what this se for:

Code:

  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,3,CH,EQ,C'$$$'),PUSH=(291:ID=1))


thank you....
Back to top
View user's profile Send private message
theone1987

New User


Joined: 14 Sep 2009
Posts: 60
Location: Milan

PostPosted: Fri Mar 19, 2010 2:57 pm    Post subject: Re: Reply to: 2 input file ==> 2 output file
Reply with quote

Skolusu wrote:
thenone1987,


ok, I found the error.

however there are instructions that I have never used (I am not an expert, yet), so might you explain it?
eg
a)
/ / SORTOUT DD DSN = & & HEADR, DISP = (, PASS), SPACE = (TRK, (1,0), RLSE)
/ / SYSIN DD *
SORT FIELDS = COPY
OUTFILE REMOVECC, BUILD = (290X), header1 = (3C '$')

b)
Inreco ifthen = (WHEN = GROUP, BEGIN = (1,3, CH, EQ, C'$$$'), PUSH = (291: ID = 1))

c)
OUTFILE = OTHER FNAMES, BUILD = (1,290)
INCLUDE = (291.1, ZD, GT, 2, AND, 58.10, CH, GT, C'2009-12-31 ', AND,
001.3, CH, N, C'$$$')


excuse me for the ignorance.
thanks.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Fri Mar 19, 2010 10:29 pm    Post subject:
Reply with quote

If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

http://www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000080
Back to top
View user's profile Send private message
theone1987

New User


Joined: 14 Sep 2009
Posts: 60
Location: Milan

PostPosted: Sat Mar 20, 2010 4:53 pm    Post subject: Re: Reply to: 2 input file ==> 2 output file
Reply with quote

Skolusu wrote:


the code works...
i have one more question left...
if I wanted to extract all records with a date less than the current date, how do I?
for example
Today is March 20, 2010, I want all records with date <January 31, 2010

I swear, this is my last question ...
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Sat Mar 20, 2010 7:26 pm    Post subject: Reply to: 2 input file ==> 2 output file
Reply with quote

If GT is greater than, maybe something very similar would be less than. . .?
Back to top
View user's profile Send private message
theone1987

New User


Joined: 14 Sep 2009
Posts: 60
Location: Milan

PostPosted: Sat Mar 20, 2010 9:34 pm    Post subject: Re: Reply to: 2 input file ==> 2 output file
Reply with quote

dick scherrer wrote:
If GT is greater than, maybe something very similar would be less than. . .?


my request was not clear ...
Now I set the date by parameter. I would rather that the date would be "calculated" according to the system date.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Sat Mar 20, 2010 10:44 pm    Post subject: Reply to: 2 input file ==> 2 output file
Reply with quote

Hello,

Quote:
my request was not clear ...
Agreed icon_smile.gif

See if this prior topic:
http://ibmmainframes.com/viewtopic.php?t=46379&highlight=symnames+date
and this one help:
http://ibmmainframes.com/viewtopic.php?t=31783&highlight=symnames+date

Between them should be all that is needed.
Back to top
View user's profile Send private message
theone1987

New User


Joined: 14 Sep 2009
Posts: 60
Location: Milan

PostPosted: Sat Mar 20, 2010 11:45 pm    Post subject: Re: Reply to: 2 input file ==> 2 output file
Reply with quote

dick scherrer wrote:

Between them should be all that is needed.


actually, It was not very useful ...
I found this topic that is similar to what I want ...
http://ibmmainframes.com/viewtopic.php?t=47380&highlight=date

could i write in my icetool in this way?

Code:

OUTFIL FNAMES=ONLYF1,BUILD=(1,290),                               
  INCLUDE=(291,1,ZD,EQ,1,AND,58,10,CH,LT,CURRENT DATE - 2)             
                                                                   
  OUTFIL FNAMES=OTHER,BUILD=(1,290),                               
  INCLUDE=(291,1,ZD,GT,2,AND,38,10,CH,GT,CURRENT DATE - 2,AND,         
           001,3,CH,NE,C'$$$')                                     
//*


To subtract 2 months to the current date...
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Sun Mar 21, 2010 1:47 am    Post subject: Reply to: 2 input file ==> 2 output file
Reply with quote

...Sigh. . .

Quote:
actually, It was not very useful ...
Please explain. . .

Using the info from those posts you can build a SYMNAMS value you could use to compare the dates. . .

Or is there something else that is not yet clear?
Back to top
View user's profile Send private message
theone1987

New User


Joined: 14 Sep 2009
Posts: 60
Location: Milan

PostPosted: Mon Mar 22, 2010 2:05 pm    Post subject: Re: Reply to: 2 input file ==> 2 output file
Reply with quote

dick scherrer wrote:


i wrote this statment
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SYMNAMES DD *
CURDT,S'&YR4.-&MON.-&DAY'
//SORTIN DD *
DUMMY REC

the result is
Code:
 2010-03-22


What should I do if I wanted to get
Code:
 2010-01-31


ie two months ago (the last day of the month)

thank you
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Mon Mar 22, 2010 9:09 pm    Post subject:
Reply with quote

theone1987,

You don't have to use symbols to get the desired results. You can use DATE1+n , DATE1-n (n can be any number from 1 to 9999), which would give current date + n days or current date - n days in C'yyyymmdd' format.


However there is no direct feature to get the last day of two months ago. There is a trick to get the last date of the month. Is there any other condition ? And please describe all your requirements at once.

Thanks
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts High CPU consumption Job using IAM fi... aswinir JCL & VSAM 8 Thu Dec 01, 2016 8:28 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us