IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Dynamically arrive filename using Suppressed Count - How?


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
rsuresh100

New User


Joined: 28 Feb 2009
Posts: 5
Location: Michigan

PostPosted: Tue Jul 30, 2013 12:08 am
Reply with quote

Hi

I have the below requirement:

Build a NDM Control card, which has the Output receiving filename in the below format:

APPL_CD_YYYYMMDD_nnnnn(...?).txt

APPL_CD - a Constant
YYYYMMDD - Asofdate - obtained from a Date VSAM file.
nnnnn(...?) - varies depending on the number of records in the Input Extract file.

For Example. assuming the AsOfDate to be 30 June 2013, and the Count of the Input file is 5000, the format of the file would look like

APPL_CD_20130630_5000.txt


The NDM card will look something like this:
Code:
SIGNON
 ............
 DSN1=ABCD.EF.GH.IJKL00.MNOPQR.S01S (0) -
 DISP=SHR
 DSN2=APPL_CD_20130630_5000.txt -
 ............
SIGNOFF
Ok, now , i am building this Control card using ICETOOL. The Variables here are the DATE and the Count. I started building the filename just for the COUNT for now (not worrying about the Date part) - using the COUNT feature and COPY feature to arrive at APPL_CD_000000152.txt

But the requirement is to get the filename as APPL_CD_152.txt (Ofcourse, i plan to add the Date part later - once i figure out how to get the Zeroes suppressed!)

What should i do to Suppress the Zeroes?

I do NOT remember the exact Code right now - maybe if needed i can provide when i get to office ... From what i remember...it looks something like below..
Code:
.....
COUNT FROM(INDD1) USING(CTL1) WRITE(COUNTDD) DIGITS(9)
COPY FROM(COUNTDD) TO(OUTDD2) USING(CTL2)

//CTL1CNTL
 SORT FIELDS=COPY
/*
//CTL2CNTL
  SORT FIELDS=COPY
  OUTFIL OUTREC=(C'APPL_CD',2,9,C'.txt')

I tried using EDCOUNT(formatting) option but end up getting the Count with Spaces something NOT like what would be desired....

APPL_CD_ 152.txt

I used the SQZ=(SHIFT=LEFT) - which said I am a fool javascript:emoticon('icon_smile.gif')

the result..... APPL_CD_152 .txt

I see that this is because of the 9 bytes i pick from the CountDD. Is there a possible approach Suppressing Zeroes?

regards

EDIT: Code'd
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Tue Jul 30, 2013 2:47 am
Reply with quote

rsuresh100 wrote:

Ok, now , i am building this Control card using ICETOOL. The Variables here are the DATE and the Count. I started building the filename just for the COUNT for now (not worrying about the Date part) - using the COUNT feature and COPY feature to arrive at APPL_CD_000000152.txt

But the requirement is to get the filename as APPL_CD_152.txt (Ofcourse, i plan to add the Date part later - once i figure out how to get the Zeroes suppressed!)

What should i do to Suppress the Zeroes?

I do NOT remember the exact Code right now - maybe if needed i can provide when i get to office ... From what i remember...it looks something like below..



You don't need two passes to get the count with leading zeroes suppressed. The date you are getting is also from the same file that you want to find the count of records or is it a different file? How do you identify the date from vsam file? Is it on every record or just the header or ?
Back to top
View user's profile Send private message
rsuresh100

New User


Joined: 28 Feb 2009
Posts: 5
Location: Michigan

PostPosted: Tue Jul 30, 2013 8:38 am
Reply with quote

Thanks for the response kolusu. The date is from a different file altogether from the other input extract file - it is a VSAM file with Unique records for different applications which forms the key. I would be picking the date from that file based on my Application key say, APPL_CD and pick the Asofdate say from position 11, a length of 8 bytes.

I would appreciate if you can let me know how you can get a count with leading zeroes suppressed and still append to the file in a single pass.
Back to top
View user's profile Send private message
rsuresh100

New User


Joined: 28 Feb 2009
Posts: 5
Location: Michigan

PostPosted: Tue Jul 30, 2013 8:47 am
Reply with quote

I find the Spaces was NOT clear in my first post....

Please Note that i was able to Suppress Zeroes using EDCOUNT formatting but ended up having Spaces in the resulting Filename

APPL_CD_bbbbbb152.txt - where 'b' is Blank/Space.

When i tried with SQZ=(SHIFT=LEFT) i get the result as

APPL_CD_152bbbbbb.txt - where 'b' is Blank/Space.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Jul 30, 2013 2:02 pm
Reply with quote

Have you considered that the field which SQZ is operating on you have not defined as long enough to include the ".txt"?
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Tue Jul 30, 2013 3:20 pm
Reply with quote

Have you considered using the code tags to preserve the spacing in your posts. You have been here long enough to know how to use them and why you need to use them.
Back to top
View user's profile Send private message
hailashwin

New User


Joined: 16 Oct 2008
Posts: 74
Location: Boston

PostPosted: Tue Jul 30, 2013 4:41 pm
Reply with quote

Hope this helps..

Code:


//TOOLIN DD *                                 
 SORT FROM(SORTIN)   TO(CTL3JNF1) USING(CTL1)
 SORT FROM(CTL3JNF1) TO(CTL3JNF2) USING(CTL2)
//*                                           
//CTL1CNTL DD *                               
 SORT FIELDS=(1,9,CH,A)                       
 INREC OVERLAY=(80:C'1')                     
 OUTFIL FNAMES=CTL3JNF1,REMOVECC,NODETAIL,   
       TRAILER1=(1:C'APPL_CD_',               
                 40:TOT=(80,1,ZD))           
//*                                           
//CTL2CNTL DD *                               
  OPTION COPY                                 
  INREC BUILD=(1,80,SQZ=(SHIFT=LEFT))         
//*                                           



Thanks,
Ashwin.
Back to top
View user's profile Send private message
hailashwin

New User


Joined: 16 Oct 2008
Posts: 74
Location: Boston

PostPosted: Tue Jul 30, 2013 5:39 pm
Reply with quote

I missed to include the .txt here, a slight modification of CTL1CNTL

Code:

//CTL1CNTL DD *                               
 SORT FIELDS=(1,9,CH,A)                       
 INREC OVERLAY=(80:C'1')                     
 OUTFIL FNAMES=CTL3JNF1,REMOVECC,NODETAIL,   
       TRAILER1=(1:C'APPL_CD_',               
                 40:TOT=(80,1,ZD),60:C'.TXT')
//*                                           
Back to top
View user's profile Send private message
rsuresh100

New User


Joined: 28 Feb 2009
Posts: 5
Location: Michigan

PostPosted: Tue Jul 30, 2013 8:16 pm
Reply with quote

Quote:
First of all - Sorry Nic, i think i did NOT pay attention - will correct going forward. Thanks for the responses Bob and Ashwin.

Bob - yes i did try SQZ and am getting precise results.Not sure if there is a better approach than below Code.
Code:

//TSYNCNT JOB ,'SYNCTOOL  ',CLASS=6,MSGCLASS=2,                     
//        NOTIFY=&SYSUID                                             
//*******************************************************************
//*   SORT DATA FILE                                                *
//*******************************************************************
//STEP01      EXEC PGM=SYNCTOOL                                     
//TOOLMSG     DD SYSOUT=*                                           
//DFSMSG      DD SYSOUT=*                                           
//SYSPRINT    DD SYSOUT=*                                           
//SYSOUT      DD SYSOUT=*                                           
//INDD1       DD *                                                   
 SIGNON                                                             
 NDM001   SUBMIT PROC=ABCASC01,CASE=YES                        -     
          &PNODE=XXXXXXXX                                      -     
          &SNODE=FILEXMIT                                      -     
          &DSN1=ABCD.YY.YY.RXX00.XXXXXXXX.SXXXX (+0)           -     
          &DISP1=SHR                                           -     
/*                                                                   
//INDD2       DD DSN=ABCD.FF.FF.RSB00.JCL.FILTRD,                   
//            DISP=SHR                                               
//INDD3       DD *                           
          &MSG='JOB01 O-NDM FAIL'           
SIGNOFF                                       
/*                                           
//OUTDD1      DD DISP=(MOD,PASS),UNIT=SYSDA   
//OUTDD2      DD DISP=(MOD,PASS),UNIT=SYSDA   
//OUTDD3      DD DISP=(MOD,PASS),UNIT=SYSDA   
//COMBINED    DD SYSOUT=*                     
//SORTOUT     DD SYSOUT=*                     
//TOOLIN DD *                                 
 COPY FROM(INDD1)  TO(COMBINED) USING(CTL1)   
 COUNT FROM(INDD2) WRITE(OUTDD1)             
 COPY FROM(OUTDD1) TO(OUTDD2)  USING(CTL2)   
 COPY FROM(OUTDD2) TO(OUTDD3)  USING(CTL3)   
 COPY FROM(OUTDD3) TO(COMBINED) USING(CTL1)   
 COPY FROM(INDD3)  TO(COMBINED) USING(CTL1)   
/*                                           
//CTL1CNTL DD *                               
 SORT FIELDS=COPY                             
/*                                           
//CTL2CNTL DD *                               
  SORT FIELDS=COPY                                         
  OUTFIL OUTREC=(10X,C'&DSN2=FOLDER_FF/APPL_CD_',         
      7,9,SQZ=(SHIFT=LEFT,PREBLANK=C'0'),C'.TXT',16X,C'-')
/*                                                         
//CTL3CNTL DD *                                           
 SORT FIELDS=COPY                                         
 OUTREC FIELDS=(10X,1,50,SQZ=(SHIFT=LEFT),64:C'-')         
/*                                 

Quote:
and i get the result as seen below

Code:

SIGNON                                                           
 NDM001   SUBMIT PROC=ABCASC01,CASE=YES                        -   
          &PNODE=XXXXXXXX                                      -   
          &SNODE=FILEXMIT                                      -   
          &DSN1=ABCD.YY.YY.RXX00.XXXXXXXX.SXXXX (+0)           -   
          &DISP1=SHR                                           -   
          &DSN2=FOLDER_FF/APPL_CD_152.TXT                      -   
          &MSG='JOB01 O-NDM FAIL'                                 
SIGNOFF                                                           

Quote:

Ashwin, i tried your approach and i get the below result having Spaces. Maybe that can be fine-tuned.

Code:

&DSN2=FOLDER_FF/APPL_CD_                           152     .TXT
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Wed Aug 07, 2013 7:08 pm
Reply with quote

Suresh,

You can use the below syncsort to achieve this. Here the first step creates a symbol 'CNT1' for the record count and the second step just substitutes the count in place of the dummy count text - '$$$' in the input NDM template card.
Code:
//STEP01  EXEC PGM=SORT                                                 
//SYSOUT    DD SYSOUT=*                                                 
//SORTIN    DD DISP=SHR,DSN= Input dataset for getting count           
//SORTOUT   DD DSN=&T1,DISP=(,PASS),UNIT=SYSDA                         
//*                                                                     
//SYSIN     DD *                                                       
  OPTION COPY                                                           
  INREC IFOUTLEN=80,                                                   
        IFTHEN=(WHEN=INIT,BUILD=(1:SEQNUM,5,PD)),                       
        IFTHEN=(WHEN=INIT,                                             
             OVERLAY=(81:1,5,PD,M10,LENGTH=8)),                         
        IFTHEN=(WHEN=INIT,                                             
             OVERLAY=(C'CNT1,''',81,8,JFY=(SHIFT=LEFT,TRAIL=C'''')))   
  OUTFIL REMOVECC,NODETAIL,TRAILER1=(1,80)                             
//STEP02  EXEC PGM=SORT                                         
//SYSOUT    DD SYSOUT=*                                         
//SYMNAMES  DD DSN=&T1,DISP=(SHR,PASS)                           
//SORTIN    DD *                                                 
SIGNON                                                           
 NDM001   SUBMIT PROC=ABCASC01,CASE=YES                        -
          &PNODE=XXXXXXXX                                      -
          &SNODE=FILEXMIT                                      -
          &DSN1=ABCD.YY.YY.RXX00.XXXXXXXX.SXXXX (+0)           -
          &DISP1=SHR                                           -
          &DSN2=FOLDER_FF/APPL_CD_$$$.TXT                      -
          &MSG='JOB01 O-NDM FAIL'                               
SIGNOFF                                                         
//*                                                             
//SORTOUT   DD SYSOUT=*                                         
//*                                                             
//SYSIN     DD *                                                 
  OPTION COPY                                                   
  INREC FINDREP=(IN=C'$$$',OUT=CNT1)                             
Back to top
View user's profile Send private message
rsuresh100

New User


Joined: 28 Feb 2009
Posts: 5
Location: Michigan

PostPosted: Thu Aug 08, 2013 9:22 am
Reply with quote

Thanks Arun. I think your solution looks better - i would check it out.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts To get the count of rows for every 1 ... DB2 3
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts Validating record count of a file is ... DFSORT/ICETOOL 13
No new posts Dynamically pass table name to a sele... DB2 2
No new posts Insert header record with record coun... DFSORT/ICETOOL 14
Search our Forums:

Back to Top