OnDemand Users Group

Support Forums => Content Navigator => Topic started by: JMichael on February 11, 2022, 03:34:30 PM

Title: ARSDOCGET Command scripts
Post by: JMichael on February 11, 2022, 03:34:30 PM
Hi all,
Just a question here.  I have an "arsdocget" command script to pull back report files from CMOD archives based on load id & rpt name.  However is there a known arsdocget command script that includes a date range parameter to pull multiple report files at once?  An example of a command is shown below that pulls on one report file.

arsdoc get -vh localhost -u CMODLOAD -p /export/home/cmod/loaddstash -G MLICA_AG5_DF -X 88162-1-0-37348FAA-20210722000000-20210722000000-148004 -caN -d /cmod/Mike -o /MLICA_AG5_DF.ML000019-DF.20210722204524097590.ARD
Title: Re: ARSDOCGET Command scripts
Post by: Justin Derrick on February 22, 2022, 04:48:04 PM
Your best bet in this case is to perform a search in the client software that matches what you want to extract, then save the results as a 'Named Query', then specify the Named Query on CMOD's arsdoc get command line with the '-q' parameter.

-JD.

Title: Re: ARSDOCGET Command scripts
Post by: Michel de Kraker on September 17, 2025, 06:52:31 AM
Justin,

This helped me a lot! Thankyou.

One other question on this.

Arsdoc get -q  gets me for instance 6000 files.

Is there a possibility to have in the naming convention for each file like this:

<consignmentnr>.<reportdate>.pdf

so different names for each retrieved document.

Kind regards

Michel.
Title: Re: ARSDOCGET Command scripts
Post by: Justin Derrick on September 17, 2025, 01:49:44 PM
If you want custom filenames, I think your best bet is to do that after the fact with some custom code.  Writing it yourself allows you to do more error-checking, since arsdoc will silently over-write output files if you happen to have multiple documents with the same metadata.

If you can confirm that's not an issue, I think you can use field names in parenths to get what you want:
  arsdoc <options>   -o "(consignmentnr).(reportdate)"


-JD.
Title: Re: ARSDOCGET Command scripts
Post by: Michel de Kraker on September 18, 2025, 09:42:13 AM
Thank you Justin,

Managed to do with this script:

for i in `ls TEST*|grep -v pdf`
do
/usr/lpp/ars/afp2pdf/afp2pdf -o /tmp/cmod/michel/$i.pdf /tmp/cmod/michel/$i 2>/dev/null
CONS=`arspdump -f /tmp/cmod/michel/$i.pdf |head -36|tail -1`
A=`arspdump -f /tmp/cmod/michel/$i.pdf|head -57|tail -1` (get part of the date)
B=`arspdump -f /tmp/cmod/michel/$i.pdf|head -60|tail -1` (get part of the date)
C=`arspdump -f /tmp/cmod/michel/$i.pdf|head -63|tail -1` (get part of the date)
NEWDATEFMT=`echo $A$B"20$C"|sed "s/\//_/g"`
echo $NEWDATEFMT
echo $CONS
mv $i.pdf "$CONS"_"$NEWDATEFMT".pdf
done

This is the output (extract)

-rw-r--r--    1 root     system         4025 Sep 18 10:40 SMK8042_4_07_2016.pdf
-rw-r--r--    1 root     system         4025 Sep 18 10:40 SMK8033_4_07_2016.pdf
-rw-r--r--    1 root     system         4010 Sep 18 10:40 SMB1597_9_07_2016.pdf
-rw-r--r--    1 root     system         4034 Sep 18 10:40 SMB1601_9_07_2016.pdf
-rw-r--r--    1 root     system         4044 Sep 18 10:40 SMK9775_8_07_2016.pdf
-rw-r--r--    1 root     system         4034 Sep 18 10:40 SMB1600_9_07_2016.pdf
-rw-r--r--    1 root     system         4077 Sep 18 10:41 SMK9814_8_07_2016.pdf
-rw-r--r--    1 root     system         4034 Sep 18 10:41 SMB1603_9_07_2016.pdf
-rw-r--r--    1 root     system         4034 Sep 18 10:41 SMB1514_9_07_2016.pdf
-rw-r--r--    1 root     system         4013 Sep 18 10:41 SMK8047_4_07_2016.pdf
-rw-r--r--    1 root     system         3932 Sep 18 10:41 SMK7924_3_07_2016.pdf
-rw-r--r--    1 root     system         4078 Sep 18 10:41 SMK9818_8_07_2016.pdf
-rw-r--r--    1 root     system         4077 Sep 18 10:41 SMK9824_8_07_2016.pdf


Regards

Michel
Title: Re: ARSDOCGET Command scripts
Post by: Justin Derrick on September 19, 2025, 04:40:04 PM
Only improvement I'd suggest is an if-statement that checks to see if the new filename already exists.  Otherwise, you have the same issue as arsdoc -- it will happily overwrite any existing file with a different file that has the same metadata.

Again, if you can do some pre-checking on your metadata to ensure there's only one document for your criteria, then you avoid the whole issue.

Otherwise, I'm glad to see you got something that works, and thanks for sharing your solution!

Take care.

-JD.
Title: Re: ARSDOCGET Command scripts
Post by: Michel de Kraker on September 19, 2025, 04:51:53 PM
Thankyou Justin.

Good point on the double filenames.

Regards

Michel