Need to concatenate last months ccyy



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

Need to concatenate last months ccyy

Postby KParrish » Fri May 28, 2010 9:50 pm

I need to concatenate ccyy to the beginning of each record. I know I need to use OUTREC BUILD stmt, but can't seem to get the format to just put the ccyy. I don't want the mm or dd portion of last month's complete date. Anyone know how to do this?
KParrish
 
Posts: 4
Joined: Fri May 28, 2010 9:45 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Need to concatenate last months ccyy

Postby Frank Yaeger » Fri May 28, 2010 10:14 pm

Please show an example of the records in your input file (relevant fields only) and what you expect for output. Explain the "rules" for getting from input to output. Give the starting position, length and format of all relevant fields. Give the RECFM and LRECL of the input file.
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
User avatar
Frank Yaeger
Global moderator
 
Posts: 1079
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 15 times

Re: Need to concatenate last months ccyy

Postby KParrish » Fri May 28, 2010 10:32 pm

Input file
04ADA007060209295
04ADA007060242698

desired output if run 05/2010
201004ADA007060209295
201004ADA007060242698

desired output if run 01/2010
200904ADA007060209295
200904ADA007060242698

Not understanding "rules" stmt. Trying to use DFSORT/ICETOOL to add ccyy to beginning of each record using the OUTREC BUILD control stmt.
Something like OUTREC FIELDS=(DATE2-1,1,17) but I only want and need the "year" component" of the previous month's date to concatenate to the beginning of each.
LRECL and BLKSZ are irrelevant in this case I think
KParrish
 
Posts: 4
Joined: Fri May 28, 2010 9:45 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Need to concatenate last months ccyy

Postby Frank Yaeger » Fri May 28, 2010 10:46 pm

LRECL and BLKSZ are irrelevant in this case I think


I asked for RECFM and LRECL, not LRECL and BLKSZ. The RECFM and LRECL are NOT irrelevant. Please give the RECFM and LRECL for the input file AND output file.
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
User avatar
Frank Yaeger
Global moderator
 
Posts: 1079
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 15 times

Re: Need to concatenate last months ccyy

Postby KParrish » Sat May 29, 2010 12:32 am

RECFM=FB LRECL=200
KParrish
 
Posts: 4
Joined: Fri May 28, 2010 9:45 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Need to concatenate last months ccyy

Postby Frank Yaeger » Sat May 29, 2010 1:23 am

Here's a DFSORT job that will do what you asked for:

//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SYMNAMES DD *
YRMON,S'&YR4.&MON'
/*
//SORTIN DD *
RECORD
/*
//SORTOUT DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN DD *
  OPTION COPY
  INREC IFOUTLEN=80,
    IFTHEN=(WHEN=INIT,
     BUILD=(C'PRYR,''YYYY''',81:YRMON)),
    IFTHEN=(WHEN=(85,2,CH,EQ,C'01'),
      OVERLAY=(7:81,4,ZD,SUB,+1,EDIT=(TTTT))),
    IFTHEN=(WHEN=NONE,
      OVERLAY=(7:81,4))
/*
//S2 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SORTIN DD DSN=...  input file (FB/200)
//SORTOUT DD DSN=...  output file (FB/200)
//SYSIN DD *
  OPTION COPY
  INREC BUILD=(PRYR,1,196)
/*
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
User avatar
Frank Yaeger
Global moderator
 
Posts: 1079
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 15 times

Re: Need to concatenate last months ccyy

Postby KParrish » Tue Jun 01, 2010 6:48 pm

Greatness! Thank you VERY much, works like a champ
KParrish
 
Posts: 4
Joined: Fri May 28, 2010 9:45 pm
Has thanked: 0 time
Been thanked: 0 time


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post