View previous topic :: View next topic
Author
Message
kasibhatla_hari New User Joined: 20 May 2005Posts: 11 Location: IRELAND
I have a requirement where I need to extract records based on a date field in Y2 Format. i.e. in YYMMDD.
The req is to extract all the records which are generated today i.e. the date in 149 POSITION of file and will be 250809 for todays records.
Back to top
Craq Giegerich Senior Member Joined: 19 May 2007Posts: 1512 Location: Virginia, USA
kasibhatla_hari wrote:
Hi,
I have a requirement where I need to extract records based on a date field in Y2 Format. i.e. in YYMMDD.
The req is to extract all the records which are generated today i.e. the date in 149 POSITION of file and will be 250809 for todays records.
I request if some one has a code to do it by DFSORT else I need to go with Easytrieve or COBB.
Thanks a mill
250809 or 090825?
What is the format of the date, Zoned decimal, packed decimal, binary?
Back to top
kasibhatla_hari New User Joined: 20 May 2005Posts: 11 Location: IRELAND
Hi Craq, Apologise for the unduly chaos created by me. The date is in 090825 format.
Sample data furnished below: Pl. ack. Thanx a mill.
Code:
COMMAND ===>
-5----+----6----+----7----+----8
840228X 010823 03
840228X 020307 09
840704X 010301 00
871021X 010307 06
840228X 090714P 1ZZ 0
840228X 970623 1ZZ 0
961022X 010927 03
020306X 020515 09
Code'd
Back to top
kasibhatla_hari New User Joined: 20 May 2005Posts: 11 Location: IRELAND
I tried the below SYSIN but I couldn't figure it out what I am missing. I tried (153,6,Y2W,EQ,Y'DATE1')( its a VB file so 149 +4). But the output is picking up OLD dates.
Code:
//SYSIN DD *
SORT FIELDS=(COPY)
OPTION VLSHRT
INCLUDE COND=((248,01,CH,EQ,C'F'),OR,
(014,15,CH,EQ,C'AAAAAAAAAAAAAAA'),OR,
(014,15,CH,EQ,C'ZZZZZZZZZZZZZZZ'),AND,
(153,6,Y2W,EQ,Y'DATE1'))
OUTFIL FNAMES=SORTOUT,OUTREC=(1:1,4,5:5,748),VLFILL=C' '
/*
OUTPUT:
Command ===>
-5----+----6----+----7----+
071123X.......090209 ......
010417X.......011123 ......
000504X.......020307 ......
990119X.......020307 ......
840503X.......020307 ......
010907X.......020308 ......
010222X.......020307 ......
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
Y2W is for a CH or ZD date in mmddyy form. Y2T is for a CH or ZD date in yymmdd form.
It's not really clear which form of the date you have and where it is.
If it's really in 149+4 = 153 and in the form 'yymmdd', then 153,6,Y2T,EQ,Y'DATE1' should work.
I'd also suggest using VLSCMP instead of VLSHRT.
If that doesn't work, then you need to do a better job of showing your input records and expected output and giving the correct starting position, length and format and form of the date.
Back to top
kasibhatla_hari New User Joined: 20 May 2005Posts: 11 Location: IRELAND
Perfect Frank its working. Thanx a mill for all your help. I didn't change VLSHRT to VLSCMP.
WORKING CODE:
--------------------
Code:
SORT FIELDS=(COPY)
OPTION VLSHRT
INCLUDE COND=(((153,6,Y2T,EQ,Y'DATE1'),AND,
(248,01,CH,EQ,C'F')),OR,
((014,15,CH,EQ,C'AAAAAAAAAAAAAAA'),OR,
(014,15,CH,EQ,C'ZZZZZZZZZZZZZZZ')))
OUTFIL FNAMES=SORTOUT,OUTREC=(1:1,4,5:5,748),VLFILL=C' '
Back to top
Please enable JavaScript!