Author Topic: Can i index from filename  (Read 2885 times)

MHassan

  • Jr. Member
  • **
  • Posts: 64
    • View Profile
Can i index from filename
« on: October 23, 2019, 02:19:08 AM »
when i write the pattern of any pdf to auto load (App Group.App.3.4.5.6.pdf or ard) what i want that if i put in 3 or 4 or 5 or 6 any metadata can i extract this meta data and assign it to a field , is this valid in CMOD or not ?
For exmaple if i index the file name and put in the  3rd field branch name for a bank i want to split this from the pattern name and put it on a field i am creating
« Last Edit: October 23, 2019, 02:22:36 AM by MHassan »

Joe Wolken

  • Full Member
  • ***
  • Posts: 113
  • CMOD iSeries Consultant
    • View Profile
    • OAS Corp.
Re: Can i index from filename
« Reply #1 on: October 23, 2019, 08:32:01 AM »
I have tried to do this using the ARSLOAD -B parameter.  The way I read the documentation, it sounds as if the ARSLOAD would then build your .IND file using using your field names and GROUP_OFFSET =0 and GROUP_LENGTH=0. 

This would be nice, but it appears that you also have to provide your own .ARD and .IND file with the same name as the file you want to load with the OFFSET and LENGTH values specified and the CODEPAGE set to your value.  Then the -B parameter will add the index values.

I have had to write my own program to monitor a directory, parse the fields from the filename and create the .IND file.

It would be great if OnDemand would add the function you are requesting.

Joe
#Installation #Upgrade #Migration #Administration #Integration #Customization #Training, and more!

Call: 512-402-1123
email: wolkenj@oascorp.com 
Click: http://www.OASCorp.com

MHassan

  • Jr. Member
  • **
  • Posts: 64
    • View Profile
Re: Can i index from filename
« Reply #2 on: November 04, 2019, 10:53:04 AM »
Hello Joe wolken,

Thank you for your reply,

But can you provide me steps for using the -B parameter in arsload command

thanks in advance

dineshkhanna04

  • Guest
Re: Can i index from filename
« Reply #3 on: November 05, 2019, 04:02:33 AM »
Hi MHassan,

If you are planning to get the index values from the file name, you can try using something like below.

arsload -fnv -I <inst> -u <user> -a <Appln> -b "1,<index1>" -b "2,<index2>" -B "1FLD.2YY.EXT" file2load.ARD

Thanks,
Dinesh Khanna

Joe Wolken

  • Full Member
  • ***
  • Posts: 113
  • CMOD iSeries Consultant
    • View Profile
    • OAS Corp.
Re: Can i index from filename
« Reply #4 on: November 05, 2019, 07:09:02 AM »
This is what I found worked for me.  As I mentioned previously, I found that you must already have created a .ARD file and a .IND file (containing no index data) with the same name.

Application Group INVOICEAG contains 3 fields, NAME, INVNUMBER, RPTDATE with format YYYYMMDD.
Application INVOICE is defined as Generic Indexer with data type PDF.

These files exist in my directory:
INVOICEAG.INVOICE.TESTNAME.987654.20190221.ARD   
INVOICEAG.INVOICE.TESTNAME.987654.20190221.ARD.IND
INVOICEAG.INVOICE.TESTNAME.987654.20190221.ARD.PDF

The content of the .IND file are:
COMMENT:                                                                       
CODEPAGE:37                                                                     
COMMENT:                                                                       
GROUP_OFFSET:0                                                                 
GROUP_LENGTH:0                                                                   
GROUP_FILENAME:/ascent/Scan02/INVOICEAG.INVOICE.TESTNAME.987654.20190221.ARD.PDF
 
This arsload command worked to load a specific file:
arsload -h ONDENU -v -G MVS -A JOBNAME -b 1,NAME -b 2,INVNUMBER -b 3,RPTDATE -B MVS.JOB.1FLD.2FLD.3FLD /ascent/Scan02/INVOICEAG.INVOICE.TESTNAME.987654.20190221.ARD

Joe
#Installation #Upgrade #Migration #Administration #Integration #Customization #Training, and more!

Call: 512-402-1123
email: wolkenj@oascorp.com 
Click: http://www.OASCorp.com

MHassan

  • Jr. Member
  • **
  • Posts: 64
    • View Profile
Re: Can i index from filename
« Reply #5 on: November 05, 2019, 08:05:38 AM »
Hello dineshkhanna04,

So i just want to ask you about the steps to do this because when i try to run the command it show me an error and i don't know the right steps to do this ,

What i have done :
1- I create application group and application in CMOD
2- I create a field in application
3-i ran the command like this : arsload -nfv -u admin -p demo -b "1,Name of AG"
-b "2,Name of App" -b "3,Name of field" -B "1AG,2APP,3FLD"  but i don't know how to but the my pdf file in command so that the CMOD Server load it into CMOD and load value into the field i provide it with

Should i rename my pdf with the appgroup and app and value of the field i want to load ??

MHassan

  • Jr. Member
  • **
  • Posts: 64
    • View Profile
Re: Can i index from filename
« Reply #6 on: November 05, 2019, 08:08:51 AM »
Hello Joe,

why should i create .ind and .ard by my self ??

dineshkhanna04

  • Guest
Re: Can i index from filename
« Reply #7 on: November 05, 2019, 08:42:25 PM »
Hello dineshkhanna04,

So i just want to ask you about the steps to do this because when i try to run the command it show me an error and i don't know the right steps to do this ,

What i have done :
1- I create application group and application in CMOD
2- I create a field in application
3-i ran the command like this : arsload -nfv -u admin -p demo -b "1,Name of AG"
-b "2,Name of App" -b "3,Name of field" -B "1AG,2APP,3FLD"  but i don't know how to but the my pdf file in command so that the CMOD Server load it into CMOD and load value into the field i provide it with

Should i rename my pdf with the appgroup and app and value of the field i want to load ??

Based on my understanding your query was to fetch the index values from the file name. If this is correct, then your pdf file should have the value of the fields. You have to put the name of the pdf file after the -B as below.

-B "1FLD.2YY.EXT" index1.04112000.pdf

I guess you missed the extension in -B parameter. Also if your indexes in the pdf file name are delimited by "," (comma) you have to use -J parameter in your arsload command.

MHassan

  • Jr. Member
  • **
  • Posts: 64
    • View Profile
Re: Can i index from filename
« Reply #8 on: November 06, 2019, 05:19:09 AM »
This is what I found worked for me.  As I mentioned previously, I found that you must already have created a .ARD file and a .IND file (containing no index data) with the same name.

Application Group INVOICEAG contains 3 fields, NAME, INVNUMBER, RPTDATE with format YYYYMMDD.
Application INVOICE is defined as Generic Indexer with data type PDF.

These files exist in my directory:
INVOICEAG.INVOICE.TESTNAME.987654.20190221.ARD   
INVOICEAG.INVOICE.TESTNAME.987654.20190221.ARD.IND
INVOICEAG.INVOICE.TESTNAME.987654.20190221.ARD.PDF

The content of the .IND file are:
COMMENT:                                                                       
CODEPAGE:37                                                                     
COMMENT:                                                                       
GROUP_OFFSET:0                                                                 
GROUP_LENGTH:0                                                                   
GROUP_FILENAME:/ascent/Scan02/INVOICEAG.INVOICE.TESTNAME.987654.20190221.ARD.PDF
 
This arsload command worked to load a specific file:
arsload -h ONDENU -v -G MVS -A JOBNAME -b 1,NAME -b 2,INVNUMBER -b 3,RPTDATE -B MVS.JOB.1FLD.2FLD.3FLD /ascent/Scan02/INVOICEAG.INVOICE.TESTNAME.987654.20190221.ARD

Joe

Thank you very much for your reply , i want to make a date in my filename and load into cmod and create a field that can i set in it the date to search for a specific date , that field its datatype is Date not string